Complete rework of makefile generators expect trouble

This commit is contained in:
Bill Hoffman 2002-11-08 15:46:08 -05:00
parent c72462ffb1
commit f5d95fb078
68 changed files with 1572 additions and 531 deletions

View File

@ -5,18 +5,19 @@ IF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -timplicit_local -no_implicit_include ")
ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)
ENDIF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
SUBDIRS(Source Modules Templates Utilities)
ENABLE_TESTING()
# Include the standard Dart testing module
INCLUDE (${CMake_SOURCE_DIR}/Modules/Dart.cmake)
INCLUDE (${CMAKE_BINARY_DIR}/Source/InitialConfigureFlags.cmake OPTIONAL)
IF(CMAKE_CONFIGURE_INSTALL_PREFIX)
SET(CMAKE_INSTALL_PREFIX ${CMAKE_CONFIGURE_INSTALL_PREFIX} )
ENDIF(CMAKE_CONFIGURE_INSTALL_PREFIX)
# use the ansi CXX compile flag for building cmake
IF (CMAKE_ANSI_CXXFLAGS)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_ANSI_CXXFLAGS}")
ENDIF (CMAKE_ANSI_CXXFLAGS)

View File

@ -1,2 +1,10 @@
#
INCLUDE(${CMAKE_ROOT}/Modules/TestForANSIStreamHeaders.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/CheckIncludeFileCXX.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/TestForSTDNamespace.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/TestForANSIForScope.cmake)
CHECK_INCLUDE_FILE_CXX("sstream" CMAKE_HAS_ANSI_STRING_STREAM)
IF(NOT CMAKE_HAS_ANSI_STRING_STREAM)
SET( CMAKE_NO_ANSI_STRING_STREAM 1 CACHE INTERNAL
"Does the compiler support sstream or stringstream.")
ENDIF(NOT CMAKE_HAS_ANSI_STRING_STREAM)

View File

@ -2,3 +2,4 @@ SET(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@")
SET(CMAKE_AR "@CMAKE_AR@")
SET(CMAKE_RANLIB "@CMAKE_RANLIB@")
SET(CMAKE_COMPILER_IS_GNUGCC @CMAKE_COMPILER_IS_GNUGCC@)

View File

@ -1,2 +1,2 @@
SET(CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@")
SET(CMAKE_COMPILER_IS_GNUGXX @CMAKE_COMPILER_IS_GNUGXX@)
SET(CMAKE_COMPILER_IS_GNUCXX @CMAKE_COMPILER_IS_GNUCXX@)

View File

@ -16,22 +16,22 @@
# variables supplied by the generator at use time
# <TARGET>
# <TARGET_BASE> the target without the suffix
# <OBJECTS>
# <OBJECT>
# <LINK_LIBRARIES>
# <FLAGS>
# CXX compiler information
# <CMAKE_CXX_COMPILER>
# <CMAKE_CXX_COMPILE_FLAGS>
# <CMAKE_CXX_SHARED_LIBRARY_CREATE_FLAGS>
# <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS>
# <CMAKE_CXX_SHARED_MODULE_CREATE_FLAGS>
# <CMAKE_CXX_LINK_FLAGS>
# C compiler information
# <CMAKE_C_COMPILER>
# <CMAKE_C_COMPILE_FLAGS>
# <CMAKE_C_SHARED_LIBRARY_CREATE_FLAGS>
# <CMAKE_C_SHARED_MODULE_CREATE_FLAGS>
# <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS>
# <CMAKE_SHARED_MODULE_CREATE_C_FLAGS>
# <CMAKE_C_LINK_FLAGS>
# Static library tools
@ -42,7 +42,7 @@
# create a shared C++ library
IF(NOT CMAKE_CXX_CREATE_SHARED_LIBRARY)
SET(CMAKE_CXX_CREATE_SHARED_LIBRARY
"<CMAKE_CXX_COMPILER> <CMAKE_CXX_SHARED_LIBRARY_CREATE_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
"<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
ENDIF(NOT CMAKE_CXX_CREATE_SHARED_LIBRARY)
# create a c++ shared module copy the shared library rule by default
@ -53,7 +53,7 @@ ENDIF(NOT CMAKE_CXX_CREATE_SHARED_MODULE)
# create a C shared library
IF(NOT CMAKE_C_CREATE_SHARED_LIBRARY)
SET(CMAKE_C_CREATE_SHARED_LIBRARY
"<CMAKE_C_COMPILER> <CMAKE_C_SHARED_LIBRARY_CREATE_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
"<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
ENDIF(NOT CMAKE_C_CREATE_SHARED_LIBRARY)
# create a C shared module just copy the shared library rule
@ -78,23 +78,23 @@ ENDIF(NOT CMAKE_C_CREATE_STATIC_LIBRARY)
# compile a C++ file into an object file
IF(NOT CMAKE_CXX_COMPILE_OBJECT)
SET(CMAKE_CXX_COMPILE_OBJECT
"<CMAKE_CXX_COMPILER> -o <OBJECT> <CMAKE_CXX_COMPILE_FLAGS> -c <SOURCE>")
"<CMAKE_CXX_COMPILER> -o <OBJECT> <FLAGS> -c <SOURCE>")
ENDIF(NOT CMAKE_CXX_COMPILE_OBJECT)
# compile a C file into an object file
IF(NOT CMAKE_C_COMPILE_OBJECT)
SET(CMAKE_C_COMPILE_OBJECT
"<CMAKE_C_COMPILER> -o <OBJECT> <CMAKE_C_COMPILE_FLAGS> -c <SOURCE>")
"<CMAKE_C_COMPILER> -o <OBJECT> <FLAGS> -c <SOURCE>")
ENDIF(NOT CMAKE_C_COMPILE_OBJECT)
IF(NOT CMAKE_C_LINK_EXECUTABLE)
SET(CMAKE_C_LINK_EXECUTABLE
"<CMAKE_C_COMPILER> <CMAKE_C_LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
"<CMAKE_C_COMPILER> <CMAKE_C_LINK_FLAGS> <FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
ENDIF(NOT CMAKE_C_LINK_EXECUTABLE)
IF(NOT CMAKE_CXX_LINK_EXECUTABLE)
SET(CMAKE_CXX_LINK_EXECUTABLE
"<CMAKE_CXX_COMPILER> <CMAKE_CXX_LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
"<CMAKE_CXX_COMPILER> <CMAKE_CXX_LINK_FLAGS> <FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
ENDIF(NOT CMAKE_CXX_LINK_EXECUTABLE)

View File

@ -1,16 +1,22 @@
# determine the compiler to use for C programs
# NOTE, a generator may set CMAKE_C_COMPILER before
# loading this file to force a compiler.
# use environment variable CCC first if defined by user, next use
# the cmake variable CMAKE_GENERATOR_CC which can be defined by a generator
# as a default compiler
FIND_PROGRAM(CMAKE_C_COMPILER_FULLPATH NAMES $ENV{CC} gcc cc cl bcc )
FIND_PROGRAM(CMAKE_C_COMPILER_FULLPATH NAMES $ENV{CC} ${CMAKE_GENERATOR_CC} gcc cc cl bcc )
GET_FILENAME_COMPONENT(CMAKE_C_COMPILER ${CMAKE_C_COMPILER_FULLPATH} NAME_WE)
# set this to notfound right after so that it is searched for each time this
# file is included
SET(CMAKE_C_COMPILER_FULLPATH NOTFOUND CACHE INTERNAL "full path to c compiler" FORCE)
FIND_PROGRAM(CMAKE_AR NAMES ar PATHS /bin /usr/bin /usr/local/bin)
FIND_PROGRAM(CMAKE_RANLIB NAMES ranlib PATHS /bin /usr/bin /usr/local/bin)
IF(NOT CMAKE_RANLIB)
SET(RANLIB :)
SET(CMAKE_RANLIB : CACHE INTERNAL "noop for ranlib")
ENDIF(NOT CMAKE_RANLIB)
MARK_AS_ADVANCED(CMAKE_RANLIB)
# test to see if the c compiler is gnu
EXEC_PROGRAM(${CMAKE_C_COMPILER} ARGS -E ${CMAKE_ROOT}/Modules/CMakeTestGNU.c OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT RETURN_VALUE CMAKE_COMPILER_RETURN)
IF(NOT CMAKE_COMPILER_RETURN)
@ -19,6 +25,8 @@ IF(NOT CMAKE_COMPILER_RETURN)
ENDIF(${CMAKE_COMPILER_OUTPUT} MATCHES ".*THIS_IS_GNU.*" )
ENDIF(NOT CMAKE_COMPILER_RETURN)
# configure variables set in this file for fast reload later on
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeCCompiler.cmake.in
${PROJECT_BINARY_DIR}/CMakeCCompiler.cmake)
${PROJECT_BINARY_DIR}/CMakeCCompiler.cmake IMMEDIATE)
MARK_AS_ADVANCED(CMAKE_AR CMAKE_C_COMPILER_FULLPATH)

View File

@ -1,18 +1,27 @@
# determine the compiler to use for C++ programs
# NOTE, a generator may set CMAKE_CXX_COMPILER before
# loading this file to force a compiler.
# use environment variable CXX first if defined by user, next use
# the cmake variable CMAKE_GENERATOR_CXX which can be defined by a generator
# as a default compiler
FIND_PROGRAM(CMAKE_CXX_COMPILER_FULLPATH NAMES $ENV{CXX} c++ g++ CC aCC cl bcc )
FIND_PROGRAM(CMAKE_CXX_COMPILER_FULLPATH NAMES $ENV{CXX} ${CMAKE_GENERATOR_CXX} c++ g++ CC aCC cl bcc )
GET_FILENAME_COMPONENT(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER_FULLPATH} NAME_WE)
# set this to notfound right after so that it is searched for each time this
# file is included
SET(CMAKE_CXX_COMPILER_FULLPATH NOTFOUND CACHE INTERNAL "full path to cxx compiler" FORCE)
# test to see if the cxx compiler is gnu
EXEC_PROGRAM(${CMAKE_CXX_COMPILER} ARGS -E ${CMAKE_ROOT}/Modules/CMakeTestGNU.c OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT RETURN_VALUE CMAKE_COMPILER_RETURN)
IF(NOT CMAKE_COMPILER_RETURN)
IF(${CMAKE_COMPILER_OUTPUT} MATCHES ".*THIS_IS_GNU.*" )
SET(CMAKE_COMPILER_IS_GNUGXX 1)
SET(CMAKE_COMPILER_IS_GNUCXX 1)
ENDIF(${CMAKE_COMPILER_OUTPUT} MATCHES ".*THIS_IS_GNU.*" )
ENDIF(NOT CMAKE_COMPILER_RETURN)
# configure all variables set in this file
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeCXXCompiler.cmake.in
${PROJECT_BINARY_DIR}/CMakeCXXCompiler.cmake)
${PROJECT_BINARY_DIR}/CMakeCXXCompiler.cmake IMMEDIATE)
MARK_AS_ADVANCED(CMAKE_CXX_COMPILER_FULLPATH)

View File

@ -60,6 +60,8 @@ IF(CMAKE_SYSTEM_VERSION)
SET(CMAKE_SYSTEM ${CMAKE_SYSTEM}-${CMAKE_SYSTEM_VERSION})
ENDIF(CMAKE_SYSTEM_VERSION)
# configure variables set in this file for fast reload
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeSystem.cmake.in
${PROJECT_BINARY_DIR}/CMakeSystem.cmake)
${PROJECT_BINARY_DIR}/CMakeSystem.cmake IMMEDIATE)

View File

@ -8,12 +8,13 @@ MESSAGE("CMAKE_C_COMPILER is ${CMAKE_C_COMPILER}")
MESSAGE("CMAKE_CXX_COMPILER is ${CMAKE_CXX_COMPILER}")
MESSAGE("CMAKE_SHARED_LIBRARY_CREATE_FLAGS is ${CMAKE_SHARED_LIBRARY_CREATE_FLAGS}")
MESSAGE("CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS is ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}")
MESSAGE("CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS is ${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS}")
MESSAGE("CMAKE_DL_LIBS is ${CMAKE_DL_LIBS}")
MESSAGE("CMAKE_SHARED_LIBRARY_PREFIX is ${CMAKE_SHARED_LIBRARY_PREFIX}")
MESSAGE("CMAKE_SHARED_LIBRARY_SUFFIX is ${CMAKE_SHARED_LIBRARY_SUFFIX}")
MESSAGE("CMAKE_COMPILER_IS_GNUGCC = ${CMAKE_COMPILER_IS_GNUGCC}")
MESSAGE("CMAKE_COMPILER_IS_GNUGXX = ${CMAKE_COMPILER_IS_GNUGXX}")
MESSAGE("CMAKE_COMPILER_IS_GNUCXX = ${CMAKE_COMPILER_IS_GNUCXX}")
MESSAGE("CMAKE_CXX_CREATE_SHARED_LIBRARY is ${CMAKE_CXX_CREATE_SHARED_LIBRARY}")
MESSAGE("CMAKE_CXX_CREATE_SHARED_MODULE is ${CMAKE_CXX_CREATE_SHARED_MODULE}")

View File

@ -1,3 +1,4 @@
SET(CMAKE_SYSTEM "@CMAKE_SYSTEM@")
SET(CMAKE_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@")
SET(CMAKE_SYSTEM_VERSION "@CMAKE_SYSTEM_VERSION@")

View File

@ -11,29 +11,34 @@
# 1. set default values that will work for most system
# suffix that needs to be added onto a library to link it .lib on windows
# not used on most unix systems
SET(CMAKE_LINK_LIBRARY_SUFFIX "")
SET(CMAKE_STATIC_LIBRARY_PREFIX "lib")
SET(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "") # -pic
SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "") # -pic
SET(CMAKE_SHARED_LIBRARY_CREATE_FLAGS "") # -shared
SET(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib
SET(CMAKE_SHARED_LIBRARY_SUFFIX ".so") # .so
SET(CMAKE_DL_LIBS "-ldl")
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "") # -pic
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared
SET(CMAKE_SHARED_LIBRARY_LINK_FLAGS "") # +s, flag for exe link to use shared lib
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG "") # -rpath
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP "") # : or empty
SET(CMAKE_LIBRARY_PATH_FLAG "-L")
SET(CMAKE_LINK_LIBRARY_FLAG "-l")
IF(CMAKE_COMPILER_IS_GNUGXX)
IF(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic
SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fPIC") # -pic
ENDIF(CMAKE_COMPILER_IS_GNUGXX)
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
SET (CMAKE_SKIP_RPATH "NO" CACHE BOOL
"If set, runtime paths are not added when using shared libraries.")
MARK_AS_ADVANCED(CMAKE_SKIP_RPATH)
# 2. now include SystemName.cmake file to set the system specific information
SET(CMAKE_SYSTEM_INFO_FILE ${CMAKE_ROOT}/Modules/${CMAKE_SYSTEM_NAME}.cmake)
SET(CMAKE_SYSTEM_INFO_FILE ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}.cmake)
IF(EXISTS ${CMAKE_SYSTEM_INFO_FILE})
INCLUDE(${CMAKE_SYSTEM_INFO_FILE})
ELSE(EXISTS ${CMAKE_SYSTEM_INFO_FILE})
@ -50,17 +55,17 @@ IF(CMAKE_C_COMPILER)
SET(CMAKE_BASE_NAME gcc)
ENDIF(CMAKE_COMPILER_IS_GNUGCC)
SET(CMAKE_SYSTEM_AND_C_COMPILER_INFO_FILE
${CMAKE_ROOT}/Modules/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake)
${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake)
INCLUDE(${CMAKE_SYSTEM_AND_C_COMPILER_INFO_FILE} OPTIONAL)
ENDIF(CMAKE_C_COMPILER)
IF(CMAKE_CXX_COMPILER)
GET_FILENAME_COMPONENT(CMAKE_BASE_NAME ${CMAKE_CXX_COMPILER} NAME_WE)
# since the gnu compiler has several names force gcc
IF(CMAKE_COMPILER_IS_GNUGXX)
IF(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_BASE_NAME g++)
ENDIF(CMAKE_COMPILER_IS_GNUGXX)
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_SYSTEM_AND_CXX_COMPILER_INFO_FILE
${CMAKE_ROOT}/Modules/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake)
${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake)
INCLUDE(${CMAKE_SYSTEM_AND_CXX_COMPILER_INFO_FILE} OPTIONAL)
ENDIF(CMAKE_CXX_COMPILER)
@ -71,7 +76,7 @@ ENDIF(CMAKE_CXX_COMPILER)
IF(NOT CMAKE_MODULE_EXISTS)
SET(CMAKE_SHARED_MODULE_C_FLAGS ${CMAKE_SHARED_LIBRARY_C_FLAGS)
SET(CMAKE_SHARED_MODULE_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS})
SET(CMAKE_SHARED_MODULE_CREATE_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_FLAGS})
SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS})
SET(CMAKE_SHARED_MODULE_PREFIX ${CMAKE_SHARED_LIBRARY_PREFIX})
SET(CMAKE_SHARED_MODULE_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX})
SET(CMAKE_SHARED_MODULE_LINK_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_FLAGS})
@ -79,6 +84,28 @@ IF(NOT CMAKE_MODULE_EXISTS)
SET(CMAKE_SHARED_MODULE_RUNTIME_FLAG_SEP ${CMAKE_SHARED_MODULE_RUNTIME_FLAG_SEP})
ENDIF(NOT CMAKE_MODULE_EXISTS)
IF(NOT CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS)
SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS})
ENDIF(NOT CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS)
IF(NOT CMAKE_SHARED_LIBRARY_CXX_FLAGS)
SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_C_FLAGS})
ENDIF(NOT CMAKE_SHARED_LIBRARY_CXX_FLAGS)
IF(NOT CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS)
SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_FLAGS})
ENDIF(NOT CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS)
IF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG)
SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_FLAG})
ENDIF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG)
IF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP)
SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP})
ENDIF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP)
# include default rules that work for most unix like systems and compilers
# this file will not set anything if it is already set
INCLUDE(${CMAKE_ROOT}/Modules/CMakeDefaultMakeRuleVariables.cmake)
@ -86,3 +113,19 @@ INCLUDE(${CMAKE_ROOT}/Modules/CMakeDefaultMakeRuleVariables.cmake)
IF(CMAKE_USER_MAKE_RULES_OVERRIDE)
INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE})
ENDIF(CMAKE_USER_MAKE_RULES_OVERRIDE)
FIND_PROGRAM(CMAKE_MAKE_PROGRAM NAMES nmake gmake make )
SET(CMAKE_VERBOSE_MAKEFILE FALSE CACHE BOOL "If this value is on, makefiles will be generated without the .SILENT directive, and all commands will be echoed to the console during the make. This is useful for debugging only.")
# default build type is none
SET (CMAKE_BUILD_TYPE "" CACHE STRING
"Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
MARK_AS_ADVANCED(
CMAKE_VERBOSE_MAKEFILE
CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_CXX_FLAGS_DEBUG
CMAKE_C_FLAGS
)

View File

@ -1,7 +0,0 @@
SET(CMAKE_SHARED_LIBRARY_CREATE_FLAGS "-shared")
SET(CMAKE_DL_LIBS "-lgdi32" )
SET(CMAKE_SHARED_LIBRARY_PREFIX "")
SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dll")
# no pic for gcc on cygwin
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "")
SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "")

View File

@ -0,0 +1,6 @@
#include <${CHECK_INCLUDE_FILE_VAR}>
int main()
{
return 0;
}

View File

@ -0,0 +1,26 @@
#
# Check if the include file exists.
#
# CHECK_INCLUDE_FILE - macro which checks the include file exists.
# INCLUDE - name of include file
# VARIABLE - variable to return result
#
MACRO(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE)
SET(CHECK_INCLUDE_FILE_VAR ${INCLUDE})
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CheckIncludeFile.cxx.in
${PROJECT_BINARY_DIR}/CMakeTmp/CheckIncludeFile.cxx IMMEDIATE)
TRY_COMPILE(${VARIABLE}
${PROJECT_BINARY_DIR}
${PROJECT_BINARY_DIR}/CMakeTmp/CheckIncludeFile.cxx
OUTPUT_VARIABLE OUTPUT)
IF(${VARIABLE})
SET(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}")
ELSE(${VARIABLE})
SET(${VARIABLE} "" CACHE INTERNAL "Have include ${INCLUDE}")
WRITE_FILE(${PROJECT_BINARY_DIR}/CMakeError.log
"Determining if the include file ${INCLUDE} "
"exists failed with the following output:\n"
"${OUTPUT}\n")
ENDIF(${VARIABLE})
ENDMACRO(CHECK_INCLUDE_FILE_CXX)

View File

@ -0,0 +1,9 @@
SET(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib
SET(CMAKE_SHARED_LIBRARY_SUFFIX "..o") # .so
SET(CMAKE_DL_LIBS "-lld")
IF(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_SHARED_LIBRARY_SUFFIX ".so") # .so
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,-G") # -shared
SET(CMAKE_SHARED_LIBRARY_LINK_FLAGS "-Wl,-brtl") # +s, flag for exe link to use shared lib
ENDIF(CMAKE_COMPILER_IS_GNUCXX)

View File

View File

@ -0,0 +1,11 @@
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared")
SET(CMAKE_DL_LIBS "-lgdi32" )
SET(CMAKE_SHARED_LIBRARY_PREFIX "lib")
SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dll")
# no pic for gcc on cygwin
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "")
SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "")
INCLUDE(${CMAKE_ROOT}/Modules/Platform/gcc.cmake)
FIND_PROGRAM(CMAKE_MAKE_PROGRAM NAMES gmake make )
SET(CMAKE_BUILD_TOOL ${CMAKE_MAKE_PROGRAM} CACHE INTERNAL
"What is the target build tool cmake is generating for.")

View File

@ -0,0 +1,18 @@
SET(CMAKE_SHARED_LIBRARY_PREFIX "lib")
SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dylib")
SET(CMAKE_SHARED_MODULE_SUFFIX ".so")
SET(CMAKE_DL_LIBS "")
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib")
SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -flat_namespace -undefined suppress")
SET(CMAKE_CXX_CREATE_SHARED_LIBRARY
"<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
SET(CMAKE_C_CREATE_SHARED_LIBRARY
"<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
SET(CMAKE_CXX_CREATE_SHARED_MODULE
"<CMAKE_CXX_COMPILER> <CMAKE_SHARED_MODULE_CREATE_C_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
SET(CMAKE_C_CREATE_SHARED_MODULE
"<CMAKE_C_COMPILER> <CMAKE_SHARED_MODULE_CREATE_C_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")

View File

@ -0,0 +1,8 @@
IF(EXISTS /usr/include/dlfcn.h)
SET(CMAKE_DL_LIBS "")
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared
SET(CMAKE_SHARED_LIBRARY_LINK_FLAGS "") # +s, flag for exe link to use shared lib
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG "-Wl,-rpath,") # -rpath
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP ":") # : or empty
ENDIF(EXISTS /usr/include/dlfcn.h)

View File

@ -0,0 +1,57 @@
SET(CMAKE_SHARED_LIBRARY_SUFFIX ".sl") # .so
SET(CMAKE_DL_LIBS "-ldld")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP ":") # : or empty
# C compiler
IF(CMAKE_COMPILER_IS_GNUCC)
# gnu gcc
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,-E -Wl,-b") # -shared
SET(CMAKE_SHARED_LIBRARY_LINK_FLAGS "-Wl,+s") # +s, flag for exe link to use shared lib
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG "-Wl,+b") # -rpath
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP ":") # : or empty
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic
ELSE(CMAKE_COMPILER_IS_GNUCC)
# hp cc
SET(CMAKE_ANSI_CFLAGS "-Ae -Aa")
# use ld directly to create shared libraries for hp cc
SET(CMAKE_C_CREATE_SHARED_LIBRARY
"ld <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "+Z") # -pic
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-E -b -L/usr/lib") # -shared
SET(CMAKE_SHARED_LIBRARY_LINK_FLAGS "+s") # +s, flag for exe link to use shared lib
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG "+b") # -rpath
ENDIF(CMAKE_COMPILER_IS_GNUCC)
# CXX compiler
IF(CMAKE_COMPILER_IS_GNUCXX)
INCLUDE(${CMAKE_ROOT}/Modules/Platform/gcc.cmake)
# for gnu C++
SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fPIC") # -pic
SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-shared -Wl,-E -Wl,-b") # -shared
SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "-Wl,+s") # +s, flag for exe link to use shared lib
SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-Wl,+b") # -rpath
SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fPIC") # -pic
ELSE(CMAKE_COMPILER_IS_GNUCXX)
# for hp aCC
SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "+Z") # -pic
SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "+Z -Wl,-E -b -L/usr/lib") # -shared
SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "-Wl,+s") # +s, flag for exe link to use shared lib
SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-Wl,+b") # -rpath
SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fPIC") # -pic
SET (CMAKE_CXX_FLAGS "" CACHE STRING
"Flags used by the compiler during all build types.")
SET (CMAKE_CXX_FLAGS_DEBUG "-g" CACHE STRING
"Flags used by the compiler during debug builds.")
SET (CMAKE_CXX_FLAGS_MINSIZEREL "-O3" CACHE STRING
"Flags used by the compiler during release minsize builds.")
SET (CMAKE_CXX_FLAGS_RELEASE "-O2" CACHE STRING
"Flags used by the compiler during release builds (/MD /Ob1 /Oi /Ot /Oy /Gs will produce slightly less optimized but smaller files).")
SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g" CACHE STRING
"Flags used by the compiler during Release with Debug Info builds.")
SET (CMAKE_C_FLAGS "" CACHE STRING
"Flags for C compiler.")
ENDIF(CMAKE_COMPILER_IS_GNUCXX)

View File

@ -0,0 +1,29 @@
SET(CMAKE_DL_LIBS "")
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -rdata_shared")
SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-shared -rdata_shared")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG "-Wl,-rpath,") # -rpath
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP "") # : or empty
IF(NOT CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_CXX_CREATE_STATIC_LIBRARY
"<CMAKE_CXX_COMPILER> -ar -o <TARGET> <OBJECTS>")
SET (CMAKE_CXX_FLAGS "" CACHE STRING
"Flags used by the compiler during all build types.")
SET (CMAKE_CXX_FLAGS_DEBUG "-g" CACHE STRING
"Flags used by the compiler during debug builds.")
SET (CMAKE_CXX_FLAGS_MINSIZEREL "-O3" CACHE STRING
"Flags used by the compiler during release minsize builds.")
SET (CMAKE_CXX_FLAGS_RELEASE "-O2" CACHE STRING
"Flags used by the compiler during release builds (/MD /Ob1 /Oi /Ot /Oy /Gs will produce slightly less optimized but smaller files).")
SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2" CACHE STRING
"Flags used by the compiler during Release with Debug Info builds.")
SET (CMAKE_C_FLAGS "" CACHE STRING
"Flags for C compiler.")
ELSE(NOT CMAKE_COMPILER_IS_GNUCXX)
INCLUDE(${CMAKE_ROOT}/Modules/Platform/gcc.cmake)
ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)

View File

@ -0,0 +1,31 @@
SET(CMAKE_DL_LIBS "")
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -rdata_shared")
SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-shared -rdata_shared")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG "-Wl,-rpath,") # -rpath
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP "") # : or empty
IF(NOT CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_CXX_CREATE_STATIC_LIBRARY
"<CMAKE_CXX_COMPILER> -ar -o <TARGET> <OBJECTS>")
SET(CMAKE_ANSI_CXXFLAGS -LANG:std)
SET (CMAKE_CXX_FLAGS "" CACHE STRING
"Flags used by the compiler during all build types.")
SET (CMAKE_CXX_FLAGS_DEBUG "-g" CACHE STRING
"Flags used by the compiler during debug builds.")
SET (CMAKE_CXX_FLAGS_MINSIZEREL "-O3" CACHE STRING
"Flags used by the compiler during release minsize builds.")
SET (CMAKE_CXX_FLAGS_RELEASE "-O2" CACHE STRING
"Flags used by the compiler during release builds (/MD /Ob1 /Oi /Ot /Oy /Gs will produce slightly less optimized but smaller files).")
SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2" CACHE STRING
"Flags used by the compiler during Release with Debug Info builds.")
SET (CMAKE_C_FLAGS "" CACHE STRING
"Flags for C compiler.")
ELSE(NOT CMAKE_COMPILER_IS_GNUCXX)
INCLUDE(${CMAKE_ROOT}/Modules/Platform/gcc.cmake)
ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)

View File

@ -0,0 +1,7 @@
SET(CMAKE_DL_LIBS "-ldl")
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC")
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared")
SET(CMAKE_SHARED_LIBRARY_LINK_FLAGS "-rdynamic")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG "-Wl,-rpath,")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP ":")

View File

@ -0,0 +1,9 @@
IF(CMAKE_SYSTEM MATCHES "MP-RAS-02*.")
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC")
ELSE(CMAKE_SYSTEM MATCHES "MP-RAS-02*.")
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC")
SET(CMAKE_SHARED_LIBRARY_LINK_FLAGS "-Wl,-Bexport")
ENDIF(CMAKE_SYSTEM MATCHES "MP-RAS-02*.")

View File

@ -0,0 +1,8 @@
IF(EXISTS /usr/include/dlfcn.h)
SET(CMAKE_DL_LIBS "")
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared
SET(CMAKE_SHARED_LIBRARY_LINK_FLAGS "") # +s, flag for exe link to use shared lib
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG "-Wl,-rpath,") # -rpath
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP ":") # : or empty
ENDIF(EXISTS /usr/include/dlfcn.h)

View File

@ -0,0 +1,26 @@
SET(CMAKE_DL_LIBS "")
IF(CMAKE_SYSTEM MATCHES "OSF1-1.[012]")
ENDIF(CMAKE_SYSTEM MATCHES "OSF1-1.[012]")
IF(CMAKE_SYSTEM MATCHES "OSF1-1.*")
# OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fpic") # -pic
SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fpic") # -pic
ENDIF(CMAKE_SYSTEM MATCHES "OSF1-1.*")
IF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,-expect_unresolved,\\*") # -shared
SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-shared -Wl,-expect_unresolved,\\*") # -shared
IF(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG "-Wl,-rpath,")
ELSE(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG "-rpath,")
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP ":")
ENDIF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
IF(NOT CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_ANSI_CXXFLAGS "-std strict_ansi -nopure_cname")
ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)

View File

View File

@ -0,0 +1,4 @@
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-G 0")
SET(CMAKE_SHARED_LIBRARY_SUFFIX "..o")
SET(CMAKE_DL_LIBS "")
SET(CMAKE_SHARED_LIBRARY_LINK_FLAGS "-Wl,-D,08000000")

View File

@ -0,0 +1,4 @@
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-Kpic -belf")
SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-Kpic -belf")
SET(CMAKE_DL_LIBS "")
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-belf -Wl,-Bexport")

View File

@ -0,0 +1 @@
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC")

View File

@ -0,0 +1,25 @@
IF(CMAKE_SYSTEM MATCHES "SunOS-4.*")
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-PIC")
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,-r -nostdlib")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG "-Wl,-R,")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP ":")
ENDIF(CMAKE_SYSTEM MATCHES "SunOS-4.*")
IF(CMAKE_SYSTEM MATCHES "SunOS-5*.")
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-KPIC")
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-G")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG "-R,")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP ":")
IF(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -nostdlib")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG "-Wl,-R,")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP ":")
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
ENDIF(CMAKE_SYSTEM MATCHES "SunOS-5*.")
IF(NOT CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_CXX_CREATE_STATIC_LIBRARY
"<CMAKE_CXX_COMPILER> -xar -o <TARGET> <OBJECTS> "
"<CMAKE_RANLIB> <TARGET> ")
ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)

View File

View File

@ -0,0 +1,4 @@
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-G 0")
SET(CMAKE_SHARED_LIBRARY_SUFFIX "..o")
SET(CMAKE_DL_LIBS "")
SET(CMAKE_SHARED_LIBRARY_LINK_FLAGS "-Wl,-D,08000000")

View File

@ -0,0 +1,2 @@
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC")
SET(CMAKE_SHARED_LIBRARY_LINK_FLAGS "-Wl,-Bexport")

View File

@ -0,0 +1,2 @@
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC")
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-Wl,-Bexport")

View File

@ -0,0 +1,78 @@
SET(CMAKE_LIBRARY_PATH_FLAG "-L")
SET(CMAKE_LINK_LIBRARY_FLAG "")
# create a shared C++ library
SET(CMAKE_CXX_CREATE_SHARED_LIBRARY
"<CMAKE_CXX_COMPILER> @&&|\n-e<TARGET> -tWD <OBJECTS> <LINK_LIBRARIES>\n|"
"implib @&&|\n-w <TARGET_BASE>.lib <TARGET_BASE>.dll\n|"
)
SET(CMAKE_CXX_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_LIBRARY})
# create a C shared library
SET(CMAKE_C_CREATE_SHARED_LIBRARY
"<CMAKE_CXX_COMPILER> @&&|\n-e<TARGET> -tWD <OBJECTS> <LINK_LIBRARIES>\n|"
"implib @&&|\n-w <TARGET_BASE>.lib <TARGET_BASE>.dll\n|"
)
# create a C shared module just copy the shared library rule
SET(CMAKE_C_CREATE_SHARED_MODULE ${CMAKE_C_CREATE_SHARED_LIBRARY})
# create a C++ static library
SET(CMAKE_CXX_CREATE_STATIC_LIBRARY "tlib @&&|\n/p512 /a <TARGET> <OBJECTS_QUOTED>\n|")
# create a C static library
SET(CMAKE_C_CREATE_STATIC_LIBRARY ${CMAKE_CXX_CREATE_STATIC_LIBRARY})
# compile a C++ file into an object file
SET(CMAKE_CXX_COMPILE_OBJECT
"<CMAKE_CXX_COMPILER> @&&|\n-DWIN32 -o<OBJECT> <FLAGS> -c <SOURCE>\n|")
# compile a C file into an object file
SET(CMAKE_C_COMPILE_OBJECT
"<CMAKE_C_COMPILER> @&&|\n-DWIN32 -o<OBJECT> <FLAGS> -c <SOURCE>\n|")
SET(CMAKE_C_LINK_EXECUTABLE
"<CMAKE_C_COMPILER> @&&|\n-e<TARGET> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_LIBRARIES> <OBJECTS> \n|")
SET(CMAKE_CXX_LINK_EXECUTABLE
"<CMAKE_CXX_COMPILER> @&&|\n -e<TARGET> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_LIBRARIES> <OBJECTS> \n|")
SET (CMAKE_BUILD_TYPE Debug CACHE STRING
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel.")
# extra flags for a win32 exe
SET(CMAKE_CREATE_WIN32_EXE -tW -tWM )
# extra flags for a console app
SET(CMAKE_CREATE_CONSOLE_EXE -tWC )
SET (CMAKE_CXX_FLAGS "-w- -whid -waus -wpar -tWM -P" CACHE STRING
"Flags used to compile c++ files.")
SET (CMAKE_CXX_FLAGS_DEBUG "-Od -v" CACHE STRING
"Flags used by the compiler during debug builds.")
SET (CMAKE_CXX_FLAGS_MINSIZEREL "-O1" CACHE STRING
"Flags used by the compiler during release minsize builds.")
SET (CMAKE_CXX_FLAGS_RELEASE "-O2" CACHE STRING
"Release flags.")
SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Od" CACHE STRING
"Flags used by the compiler during Release with Debug Info builds.")
SET (CMAKE_C_FLAGS "-w- -whid -waus -tWM" CACHE STRING
"Flags for C compiler.")
SET (CMAKE_STANDARD_LIBRARIES "import32.lib" CACHE STRING
"Libraries linked by defalut with all applications.")
FIND_PROGRAM(CMAKE_MAKE_PROGRAM NAMES make )
SET(CMAKE_BUILD_TOOL ${CMAKE_MAKE_PROGRAM} CACHE INTERNAL
"What is the target build tool cmake is generating for.")
MARK_AS_ADVANCED(CMAKE_STANDARD_LIBRARIES CMAKE_MAKE_PROGRAM)

View File

@ -0,0 +1,70 @@
SET(CMAKE_LIBRARY_PATH_FLAG "-LIBPATH:")
SET(CMAKE_LINK_LIBRARY_FLAG "")
# create a shared C++ library
SET(CMAKE_CXX_CREATE_SHARED_LIBRARY
"link @<<\n /out:<TARGET> /dll <OBJECTS> <LINK_LIBRARIES> \n<<")
SET(CMAKE_CXX_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_LIBRARY})
# create a C shared library
SET(CMAKE_C_CREATE_SHARED_LIBRARY ${CMAKE_CXX_CREATE_SHARED_LIBRARY})
# create a C shared module just copy the shared library rule
SET(CMAKE_C_CREATE_SHARED_MODULE ${CMAKE_C_CREATE_SHARED_LIBRARY})
# create a C++ static library
SET(CMAKE_CXX_CREATE_STATIC_LIBRARY "lib /nologo /out:<TARGET> <OBJECTS> ")
# create a C static library
SET(CMAKE_C_CREATE_STATIC_LIBRARY ${CMAKE_CXX_CREATE_STATIC_LIBRARY})
# compile a C++ file into an object file
SET(CMAKE_CXX_COMPILE_OBJECT
"<CMAKE_CXX_COMPILER> @<<\n -DWIN32 /Fo<OBJECT> <FLAGS> -c <SOURCE>\n<<")
# compile a C file into an object file
SET(CMAKE_C_COMPILE_OBJECT
"<CMAKE_C_COMPILER> @<<\n -DWIN32 /Fo<OBJECT> <FLAGS> -c <SOURCE>\n<<")
SET(CMAKE_C_LINK_EXECUTABLE
"<CMAKE_C_COMPILER> @<<\n <CMAKE_C_LINK_FLAGS> <FLAGS> <OBJECTS> /Fe<TARGET> -link <LINK_FLAGS> <LINK_LIBRARIES>\n<<")
SET(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>")
SET(CMAKE_CXX_LINK_EXECUTABLE
"<CMAKE_CXX_COMPILER> @<<\n <CMAKE_CXX_LINK_FLAGS> <FLAGS> <OBJECTS> /Fe<TARGET> -link <LINK_FLAGS> <LINK_LIBRARIES>\n<<")
SET (CMAKE_BUILD_TYPE Debug CACHE STRING
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel.")
SET(CMAKE_CREATE_WIN32_EXE /subsystem:windows)
SET (CMAKE_CXX_FLAGS "/nologo /W3 /Zm1000 /GX /GR" CACHE STRING
"Flags used by the compiler during all build types, /GX /GR are for exceptions and rtti in VC++, /Zm1000 increases the compiler's memory allocation to support ANSI C++/stdlib.")
SET (CMAKE_CXX_FLAGS_DEBUG "/MDd /Zi /Od /GZ" CACHE STRING
"Flags used by the compiler during debug builds.")
SET (CMAKE_CXX_FLAGS_MINSIZEREL "/MD /O1" CACHE STRING
"Flags used by the compiler during release minsize builds.")
SET (CMAKE_CXX_FLAGS_RELEASE "/MD /O2" CACHE STRING
"Flags used by the compiler during release builds (/MD /Ob1 /Oi /Ot /Oy /Gs will produce slightly less optimized but smaller files).")
SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MD /Zi /O2" CACHE STRING
"Flags used by the compiler during Release with Debug Info builds.")
SET (CMAKE_C_FLAGS "/nologo /W3 /Zm1000" CACHE STRING
"Flags for C compiler.")
SET (CMAKE_STANDARD_LIBRARIES "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib" CACHE STRING
"Libraries linked by defalut with all applications.")
MARK_AS_ADVANCED(CMAKE_STANDARD_LIBRARIES)
FIND_PROGRAM(CMAKE_MAKE_PROGRAM NAMES nmake )
SET(CMAKE_BUILD_TOOL ${CMAKE_MAKE_PROGRAM} CACHE INTERNAL
"What is the target build tool cmake is generating for.")

View File

@ -0,0 +1,6 @@
SET(CMAKE_STATIC_LIBRARY_PREFIX "")
SET(CMAKE_STATIC_LIBRARY_SUFFIX ".lib")
SET(CMAKE_SHARED_LIBRARY_PREFIX "") # lib
SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") # .so
SET(CMAKE_LINK_LIBRARY_SUFFIX ".lib")
SET(CMAKE_DL_LIBS "")

View File

View File

@ -0,0 +1,18 @@
SET (CMAKE_CXX_FLAGS "" CACHE STRING
"Flags used by the compiler during all build types.")
SET (CMAKE_CXX_FLAGS_DEBUG "-g" CACHE STRING
"Flags used by the compiler during debug builds.")
SET (CMAKE_CXX_FLAGS_MINSIZEREL "-O3" CACHE STRING
"Flags used by the compiler during release minsize builds.")
SET (CMAKE_CXX_FLAGS_RELEASE "-O2" CACHE STRING
"Flags used by the compiler during release builds (/MD /Ob1 /Oi /Ot /Oy /Gs will produce slightly less optimized but smaller files).")
SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g" CACHE STRING
"Flags used by the compiler during Release with Debug Info builds.")
SET (CMAKE_C_FLAGS "" CACHE STRING
"Flags for C compiler.")

View File

@ -0,0 +1,19 @@
#
# check if the compiler supports std:: on stl classes
#
# CMAKE_NO_STD_NAMESPACE - defined accoreding to the results
#
TRY_COMPILE(CMAKE_ANSI_FOR_SCOPE ${PROJECT_BINARY_DIR}
${CMAKE_ROOT}/Modules/TestForAnsiForScope.cxx)
IF (CMAKE_ANSI_FOR_SCOPE)
SET (CMAKE_NO_ANSI_FOR_SCOPE 0 CACHE INTERNAL
"Does the compiler support ansi for scope.")
ELSE (CMAKE_ANSI_FOR_SCOPE)
SET (CMAKE_NO_ANSI_FOR_SCOPE 1 CACHE INTERNAL
"Does the compiler support ansi for scope.")
ENDIF (CMAKE_ANSI_FOR_SCOPE)

View File

@ -0,0 +1,7 @@
int main(int, char*[])
{
int i;
for(int i=0; i < 1; ++i) ;
return 0;
}

View File

@ -0,0 +1,18 @@
#
# check if the compiler supports std:: on stl classes
#
# CMAKE_NO_STD_NAMESPACE - defined accoreding to the results
#
TRY_COMPILE(CMAKE_STD_NAMESPACE ${PROJECT_BINARY_DIR}
${CMAKE_ROOT}/Modules/TestForSTDNamespace.cxx)
IF (CMAKE_STD_NAMESPACE)
SET (CMAKE_NO_STD_NAMESPACE 0 CACHE INTERNAL
"Does the compiler support std::.")
ELSE (CMAKE_STD_NAMESPACE)
SET (CMAKE_NO_STD_NAMESPACE 1 CACHE INTERNAL
"Does the compiler support std::.")
ENDIF (CMAKE_STD_NAMESPACE)

View File

@ -0,0 +1,6 @@
#include <list>
int main(int, char*[])
{
std::list<int>();
return 0;
}

View File

@ -1,4 +0,0 @@
SET(CMAKE_SHARED_LIBRARY_CREATE_FLAGS "")
SET(CMAKE_DL_LIBS "" )
SET(CMAKE_SHARED_LIBRARY_PREFIX "")
SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dll")

View File

@ -61,9 +61,7 @@ IF (WIN32)
IF(NOT UNIX)
SET(SRCS ${SRCS}
cmGlobalBorlandMakefileGenerator.cxx
cmLocalBorlandMakefileGenerator.cxx
cmGlobalNMakeMakefileGenerator.cxx
cmLocalNMakeMakefileGenerator.cxx
cmGlobalVisualStudio6Generator.cxx
cmLocalVisualStudio6Generator.cxx
cmGlobalVisualStudio7Generator.cxx

View File

@ -122,6 +122,7 @@ CMakeSetupDialog::CMakeSetupDialog(const CMakeCommandLineInfo& cmdInfo,
CWnd* pParent /*=NULL*/)
: CDialog(CMakeSetupDialog::IDD, pParent)
{
cmSystemTools::SetRunCommandHideConsole(true);
cmSystemTools::SetErrorCallback(MFCMessageCallback);
m_RegistryKey = "Software\\Kitware\\CMakeSetup\\Settings\\StartPath";
m_CacheEntriesList.m_CMakeSetupDialog = this;

52
Source/TODO Normal file
View File

@ -0,0 +1,52 @@
Variables:
CMAKE_SYSTEM
CMAKE_BUILD_TOOL borlandmake make nmake msdev devenv
CMAKE_MAKE_PROGRAM make nmake msdev devenv *** HAS TO BE IN CACHE for try compile to work
CMAKE_BUILD_TYPE Debug Release RelWithDebInfo MinSizeRel
BUILD_COMMAND needs to be removed
CMAKE_ANSI_CFLAGS
CMAKE_ANSI_CXXFLAGS
CMAKE_NO_ANSI_STRING_STREAM
CMAKE_NO_STD_NAMESPACE
CMAKE_NO_ANSI_FOR_SCOPE
CMAKE_COMPILER_IS_GNUCXX
CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION
CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_CXX_LINK_DEBUG_FLAGS
CMAKE_CXX_LINK_RELEASE_FLAGS
CMAKE_CXX_LINK_RELWITHDEBINFO_FLAGS
CMAKE_CXX_LINK_MINSIZEREL_FLAGS
CMAKE_C_LINK_DEBUG_FLAGS
CMAKE_C_LINK_RELEASE_FLAGS
CMAKE_C_LINK_RELWITHDEBINFO_FLAGS
CMAKE_C_LINK_MINSIZEREL_FLAGS
CMAKE_USE_WIN32_THREADS
CMAKE_USE_SPROC
CMAKE_USE_PTHREADS
CMAKE_HP_PTHREADS
CMAKE_THREAD_LIBS
CMAKE_DL_LIBS
CMAKE_X_LIBS
CMAKE_X_CFLAGS
CMAKE_HAS_X

View File

@ -118,6 +118,15 @@ bool cmExecProgramCommand::InitialPass(std::vector<std::string> const& args)
{
std::string::size_type first = output.find_first_not_of(" \n\t\r");
std::string::size_type last = output.find_last_not_of(" \n\t\r");
if(first == std::string::npos)
{
first = 0;
}
if(last == std::string::npos)
{
last = output.size()-1;
}
std::string coutput = std::string(output, first, last-first+1);
m_Makefile->AddDefinition(output_variable.c_str(), coutput.c_str());
}

View File

@ -15,11 +15,11 @@
=========================================================================*/
#include "cmGlobalBorlandMakefileGenerator.h"
#include "cmLocalBorlandMakefileGenerator.h"
#include "cmLocalUnixMakefileGenerator.h"
#include "cmMakefile.h"
#include "cmake.h"
void cmGlobalBorlandMakefileGenerator::EnableLanguage(const char*,
void cmGlobalBorlandMakefileGenerator::EnableLanguage(const char* l,
cmMakefile *mf)
{
// now load the settings
@ -37,20 +37,21 @@ void cmGlobalBorlandMakefileGenerator::EnableLanguage(const char*,
message += outdir;
cmSystemTools::Error(message.c_str());
}
if(!this->GetLanguageEnabled("CXX"))
{
std::string fpath =
mf->GetDefinition("CMAKE_ROOT");
fpath += "/Templates/CMakeBorlandWindowsSystemConfig.cmake";
mf->ReadListFile(NULL,fpath.c_str());
this->SetLanguageEnabled("CXX");
}
mf->AddDefinition("BORLAND", "1");
mf->AddDefinition("CMAKE_GENERATOR_CC", "bcc32");
mf->AddDefinition("CMAKE_GENERATOR_CXX", "bcc32");
this->cmGlobalUnixMakefileGenerator::EnableLanguage(l, mf);
}
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *cmGlobalBorlandMakefileGenerator::CreateLocalGenerator()
{
cmLocalGenerator *lg = new cmLocalBorlandMakefileGenerator;
cmLocalUnixMakefileGenerator *lg = new cmLocalUnixMakefileGenerator;
lg->SetIncludeDirective("!include");
lg->SetWindowsShell(true);
lg->SetMakefileVariableSize(32);
lg->SetGlobalGenerator(this);
return lg;
}

View File

@ -213,8 +213,7 @@ cmLocalGenerator *cmGlobalGenerator::CreateLocalGenerator()
return lg;
}
void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator *gen,
cmMakefile *)
void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator *gen )
{
// create a temp generator
cmLocalGenerator *lg = this->CreateLocalGenerator();

View File

@ -79,8 +79,7 @@ public:
/**
* Try to determine system infomation, get it from another generator
*/
virtual void EnableLanguagesFromGenerator(cmGlobalGenerator *gen,
cmMakefile *mf);
virtual void EnableLanguagesFromGenerator(cmGlobalGenerator *gen);
/**
* Try running cmake and building a file. This is used for dynalically
@ -98,7 +97,9 @@ public:
cmake *GetCMakeInstance() {
return this->m_CMakeInstance; };
void SetConfiguredFilesPath(const char* s){m_ConfiguredFilesPath = s;}
protected:
cmStdString m_ConfiguredFilesPath;
cmake *m_CMakeInstance;
std::vector<cmLocalGenerator *> m_LocalGenerators;

View File

@ -15,33 +15,25 @@
=========================================================================*/
#include "cmGlobalNMakeMakefileGenerator.h"
#include "cmLocalNMakeMakefileGenerator.h"
#include "cmLocalUnixMakefileGenerator.h"
#include "cmMakefile.h"
void cmGlobalNMakeMakefileGenerator::EnableLanguage(const char*,
void cmGlobalNMakeMakefileGenerator::EnableLanguage(const char* l,
cmMakefile *mf)
{
// now load the settings
if(!mf->GetDefinition("CMAKE_ROOT"))
{
cmSystemTools::Error(
"CMAKE_ROOT has not been defined, bad GUI or driver program");
return;
}
if(!this->GetLanguageEnabled("CXX"))
{
std::string fpath =
mf->GetDefinition("CMAKE_ROOT");
fpath += "/Templates/CMakeNMakeWindowsSystemConfig.cmake";
mf->ReadListFile(NULL,fpath.c_str());
this->SetLanguageEnabled("CXX");
}
// pick a default
mf->AddDefinition("CMAKE_GENERATOR_CC", "cl");
mf->AddDefinition("CMAKE_GENERATOR_CXX", "cl");
this->cmGlobalUnixMakefileGenerator::EnableLanguage(l, mf);
}
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *cmGlobalNMakeMakefileGenerator::CreateLocalGenerator()
{
cmLocalGenerator *lg = new cmLocalNMakeMakefileGenerator;
cmLocalUnixMakefileGenerator *lg = new cmLocalUnixMakefileGenerator;
lg->SetWindowsShell(true);
lg->SetMakeSilentFlag("/nologo");
lg->SetGlobalGenerator(this);
return lg;
}

View File

@ -41,15 +41,6 @@ public:
*/
virtual void EnableLanguage(const char*,cmMakefile *mf);
/**
* Try to determine system infomation from another generator
*/
virtual void EnableLanguagesFromGenerator(cmGlobalGenerator *gen,
cmMakefile *mf)
{
this->cmGlobalGenerator::EnableLanguagesFromGenerator(gen,mf);
}
};
#endif

View File

@ -23,29 +23,26 @@
void cmGlobalUnixMakefileGenerator::EnableLanguage(const char* lang,
cmMakefile *mf)
{
// only do for global runs
if (!m_CMakeInstance->GetLocal())
{
std::string output;
std::string root
= cmSystemTools::ConvertToOutputPath(mf->GetDefinition("CMAKE_ROOT"));
// if no lang specified use CXX
if(!lang )
{
lang = "CXX";
}
// if CXX or C, then enable C
if((!this->GetLanguageEnabled("C") && lang[0] == 'C'))
std::string root
= cmSystemTools::ConvertToOutputPath(mf->GetDefinition("CMAKE_ROOT"));
std::string rootBin = mf->GetHomeOutputDirectory();
if(m_ConfiguredFilesPath.size())
{
static char envCC[5000];
if(mf->GetDefinition("CMAKE_C_COMPILER"))
{
std::string env = "CC=${CMAKE_C_COMPILER}";
mf->ExpandVariablesInString(env);
strncpy(envCC, env.c_str(), 4999);
envCC[4999] = 0;
putenv(envCC);
rootBin = m_ConfiguredFilesPath;
}
bool needCBackwards = false;
bool needCXXBackwards = false;
// check for a C compiler and configure it
if(!m_CMakeInstance->GetLocal() &&
!this->GetLanguageEnabled("C") &&
lang[0] == 'C')
{
if (m_CMakeInstance->GetIsInTryCompile())
{
cmSystemTools::Error("This should not have happen. "
@ -53,17 +50,56 @@ void cmGlobalUnixMakefileGenerator::EnableLanguage(const char* lang,
"broken CMakeLists.txt file or a problematic release of "
"CMake");
}
std::string cmd = root;
cmd += "/Templates/cconfigure";
cmSystemTools::RunCommand(cmd.c_str(), output,
cmSystemTools::ConvertToOutputPath(
mf->GetHomeOutputDirectory()).c_str());
std::string fpath = mf->GetHomeOutputDirectory();
fpath += "/CCMakeSystemConfig.cmake";
mf->ReadListFile(0,fpath.c_str());
needCBackwards = true;
// Read the DetermineSystem file
std::string systemFile = root;
systemFile += "/Modules/CMakeDetermineSystem.cmake";
mf->ReadListFile(0, systemFile.c_str());
// read determine C compiler
std::string determineCFile = root;
determineCFile += "/Modules/CMakeDetermineCCompiler.cmake";
mf->ReadListFile(0,determineCFile.c_str());
this->SetLanguageEnabled("C");
}
// check for a CXX compiler and configure it
if(!m_CMakeInstance->GetLocal() &&
!this->GetLanguageEnabled("CXX") &&
strcmp(lang, "CXX") == 0)
{
needCXXBackwards = true;
std::string determineCFile = root;
determineCFile += "/Modules/CMakeDetermineCXXCompiler.cmake";
mf->ReadListFile(0,determineCFile.c_str());
this->SetLanguageEnabled("CXX");
}
std::string fpath = rootBin;
fpath += "/CMakeSystem.cmake";
mf->ReadListFile(0,fpath.c_str());
// if C, then enable C
if(lang[0] == 'C')
{
fpath = rootBin;
fpath += "/CMakeCCompiler.cmake";
mf->ReadListFile(0,fpath.c_str());
}
if(strcmp(lang, "CXX") == 0)
{
fpath = rootBin;
fpath += "/CMakeCXXCompiler.cmake";
mf->ReadListFile(0,fpath.c_str());
}
fpath = root;
fpath += "/Modules/CMakeSystemSpecificInformation.cmake";
mf->ReadListFile(0,fpath.c_str());
if(!m_CMakeInstance->GetLocal())
{
// At this point we should have enough info for a try compile
// which is used in the backward stuff
if(needCBackwards)
{
if (!m_CMakeInstance->GetIsInTryCompile())
{
// for old versions of CMake ListFiles
@ -76,37 +112,8 @@ void cmGlobalUnixMakefileGenerator::EnableLanguage(const char* lang,
}
}
}
// if CXX
if(!this->GetLanguageEnabled("CXX") && strcmp(lang, "CXX") == 0)
if(needCXXBackwards)
{
// see man putenv for explaination of this stupid code....
static char envCXX[5000];
if(mf->GetDefinition("CMAKE_CXX_COMPILER"))
{
std::string env = "CXX=${CMAKE_CXX_COMPILER}";
mf->ExpandVariablesInString(env);
strncpy(envCXX, env.c_str(), 4999);
envCXX[4999] = 0;
putenv(envCXX);
}
std::string cmd = root;
if (m_CMakeInstance->GetIsInTryCompile())
{
cmSystemTools::Error("This should not have happen. "
"If you see this message, you are probably using a "
"broken CMakeLists.txt file or a problematic release of "
"CMake");
}
cmd += "/Templates/cxxconfigure";
cmSystemTools::RunCommand(cmd.c_str(), output,
cmSystemTools::ConvertToOutputPath(
mf->GetHomeOutputDirectory()).c_str());
std::string fpath = mf->GetHomeOutputDirectory();
fpath += "/CXXCMakeSystemConfig.cmake";
mf->ReadListFile(0,fpath.c_str());
this->SetLanguageEnabled("CXX");
if (!m_CMakeInstance->GetIsInTryCompile())
{
// for old versions of CMake ListFiles
@ -114,12 +121,11 @@ void cmGlobalUnixMakefileGenerator::EnableLanguage(const char* lang,
= mf->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION");
if (!versionValue || atof(versionValue) <= 1.4)
{
fpath = root + "/Modules/CMakeBackwardCompatibilityCXX.cmake";
std::string fpath = root + "/Modules/CMakeBackwardCompatibilityCXX.cmake";
mf->ReadListFile(0,fpath.c_str());
}
}
}
// if we are from the top, always define this
mf->AddDefinition("RUN_CONFIGURE", true);
}
@ -133,33 +139,18 @@ cmLocalGenerator *cmGlobalUnixMakefileGenerator::CreateLocalGenerator()
return lg;
}
void cmGlobalUnixMakefileGenerator::EnableLanguagesFromGenerator(
cmGlobalGenerator *gen, cmMakefile *mf)
void cmGlobalUnixMakefileGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator *gen)
{
// for UNIX we just want to read in the configured files
cmLocalGenerator *lg = this->CreateLocalGenerator();
// set the Start directories
lg->GetMakefile()->SetStartDirectory(m_CMakeInstance->GetStartDirectory());
lg->GetMakefile()->SetStartOutputDirectory(m_CMakeInstance->GetStartOutputDirectory());
lg->GetMakefile()->MakeStartDirectoriesCurrent();
this->SetConfiguredFilesPath(gen->GetCMakeInstance()->GetHomeOutputDirectory());
// if C, then enable C
if(gen->GetLanguageEnabled("C"))
{
std::string fpath = mf->GetHomeOutputDirectory();
fpath += "/CCMakeSystemConfig.cmake";
lg->GetMakefile()->ReadListFile(0,fpath.c_str());
this->SetLanguageEnabled("C");
}
// if CXX
if(gen->GetLanguageEnabled("CXX"))
{
std::string fpath = mf->GetHomeOutputDirectory();
fpath += "/CXXCMakeSystemConfig.cmake";
lg->GetMakefile()->ReadListFile(0,fpath.c_str());
this->SetLanguageEnabled("CXX");
}
delete lg;
}

View File

@ -44,7 +44,7 @@ public:
/**
* Try to determine system infomation, get it from another generator
*/
virtual void EnableLanguagesFromGenerator(cmGlobalGenerator *, cmMakefile *);
virtual void EnableLanguagesFromGenerator(cmGlobalGenerator *);
};

View File

@ -106,7 +106,13 @@ bool cmIfCommand::InitialPass(std::vector<std::string> const& args)
if (!isValid)
{
this->SetError("An IF command had incorrect arguments");
std::string err = "An IF command had incorrect arguments: ";
for(int i =0; i < args.size(); ++i)
{
err += args[i];
err += " ";
}
this->SetError(err.c_str());
return false;
}
@ -177,6 +183,15 @@ bool cmIfCommand::IsTrue(const std::vector<std::string> &args, bool &isValid,
isValid = true;
}
if (args.size() == 2 && (args[0] == "MATCHES"))
{
if(!cmSystemTools::FileExists(args[1].c_str()))
{
isTrue = false;
}
isValid = true;
}
if (args.size() == 3 && (args[1] == "AND"))
{
def = makefile->GetDefinition(args[0].c_str());
@ -263,7 +278,6 @@ bool cmIfCommand::IsTrue(const std::vector<std::string> &args, bool &isValid,
}
isValid = true;
}
return isTrue;
}

View File

@ -176,7 +176,6 @@ bool cmLoadCommandCommand::InitialPass(std::vector<std::string> const& argsIn)
// the file must exist
std::string fullPath = cmDynamicLoader::LibPrefix();
fullPath += "cm" + argsIn[0] + cmDynamicLoader::LibExtension();
std::vector<std::string> args;
cmSystemTools::ExpandListArguments(argsIn, args);
@ -196,7 +195,10 @@ bool cmLoadCommandCommand::InitialPass(std::vector<std::string> const& argsIn)
fullPath = cmSystemTools::FindFile(fullPath.c_str(), path);
if (fullPath == "")
{
this->SetError("Attempt to load command failed.");
fullPath = "Attempt to load command failed from file : ";
fullPath += cmDynamicLoader::LibPrefix();
fullPath += "cm" + argsIn[0] + cmDynamicLoader::LibExtension();
this->SetError(fullPath.c_str());
return false;
}

File diff suppressed because it is too large Load Diff

View File

@ -60,12 +60,45 @@ public:
*/
virtual void OutputCheckDepends(std::ostream&);
/**
* Set to true if the shell being used is the windows shell.
* This controls if statements in the makefile and the SHELL variable.
* The default is false.
*/
void SetWindowsShell(bool v) {m_WindowsShell = v;}
///! Set the string used to include one makefile into another default is include.
void SetIncludeDirective(const char* s) { m_IncludeDirective = s; }
///! Set the flag used to keep the make program silent.
void SetMakeSilentFlag(const char* s) { m_MakeSilentFlag = s; }
///! Set max makefile variable size, default is 0 which means unlimited.
void SetMakefileVariableSize(int s) { m_MakefileVariableSize = s; }
protected:
virtual const char* GetSafeDefinition(const char*);
virtual void ProcessDepends(const cmMakeDepend &md);
virtual void OutputMakefile(const char* file, bool withDepends);
virtual void OutputTargetRules(std::ostream& fout);
virtual void OutputLinkLibraries(std::ostream&, const char* name, const cmTarget &);
void OutputLibraryRule(std::ostream& fout,
const char* name,
const cmTarget &t,
const char* prefix,
const char* suffix,
const char* createRule,
const char* comment
);
void ExpandRuleVariables(std::string& string,
const char* objects=0,
const char* target=0,
const char* linkLibs=0,
const char* source=0,
const char* object =0,
const char* flags = 0,
const char* objectsquoted = 0,
const char* targetBase = 0);
virtual void OutputSharedLibraryRule(std::ostream&, const char* name,
const cmTarget &);
virtual void OutputModuleLibraryRule(std::ostream&, const char* name,
@ -99,6 +132,12 @@ protected:
const char* target2,
bool silent = false);
virtual void BuildInSubDirectoryWindows(std::ostream& fout,
const char* directory,
const char* target1,
const char* target2,
bool silent = false);
virtual void OutputSubDirectoryVars(std::ostream& fout,
const char* var,
const char* target,
@ -109,6 +148,12 @@ protected:
SubDirectories,
bool silent = false);
virtual void OutputMakeRule(std::ostream&,
const char* comment,
const char* target,
const char* depends,
const std::vector<std::string>& commands);
virtual void OutputMakeRule(std::ostream&,
const char* comment,
const char* target,
@ -125,33 +170,25 @@ protected:
///! return true if the two paths are the same
virtual bool SamePath(const char* path1, const char* path2);
virtual std::string GetOutputExtension(const char* sourceExtension);
virtual void OutputIncludeMakefile(std::ostream&, const char* file);
void SetObjectFileExtension(const char* e) { m_ObjectFileExtension = e;}
void SetExecutableExtension(const char* e) { m_ExecutableExtension = e;}
void SetStaticLibraryExtension(const char* e) {m_StaticLibraryExtension = e;}
void SetSharedLibraryExtension(const char* e) {m_SharedLibraryExtension = e;}
void SetLibraryPrefix(const char* e) { m_LibraryPrefix = e;}
std::string CreateTargetRules(const cmTarget &target,
const char* targetName);
virtual std::string CreateMakeVariable(const char* s, const char* s2)
{
return std::string(s) + std::string(s2);
}
virtual std::string CreateMakeVariable(const char* s, const char* s2);
///! if the OS is case insensitive then return a lower case of the path.
virtual std::string LowerCasePath(const char* path)
{
return std::string(path);
}
virtual std::string LowerCasePath(const char* path);
///! for existing files convert to output path and short path if spaces
std::string ConvertToOutputForExisting(const char*);
protected:
int m_MakefileVariableSize;
std::map<cmStdString, cmStdString> m_MakeVariableMap;
std::map<cmStdString, cmStdString> m_ShortMakeVariableMap;
std::string m_IncludeDirective;
std::string m_MakeSilentFlag;
std::string m_ExecutableOutputPath;
std::string m_LibraryOutputPath;
std::string m_SharedLibraryExtension;
std::string m_ObjectFileExtension;
std::string m_ExecutableExtension;
std::string m_StaticLibraryExtension;
std::string m_LibraryPrefix;
bool m_WindowsShell;
private:
};

View File

@ -1403,8 +1403,7 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir,
cm.SetCacheArgs(*cmakeArgs);
}
// to save time we pass the EnableLanguage info directly
gg->EnableLanguagesFromGenerator(m_LocalGenerator->GetGlobalGenerator(),
this);
gg->EnableLanguagesFromGenerator(m_LocalGenerator->GetGlobalGenerator());
if (cm.Configure() != 0)
{

View File

@ -219,9 +219,9 @@ class cmIStringStream: private std::string, public std::istrstream
public:
typedef std::string StdString;
typedef std::istrstream IStrStream;
cmIStringStream(): StdString(), IStrStream(this->StdString::c_str()) {}
cmIStringStream(): StdString(), IStrStream(StdString::c_str()) {}
cmIStringStream(const std::string& s):
StdString(s), IStrStream(this->StdString::c_str()) {}
StdString(s), IStrStream(StdString::c_str()) {}
std::string str() const { return *this; }
void str(const std::string& s)
{

View File

@ -124,7 +124,7 @@ cmSystemTools::GetTime(void)
#endif /* !HAVE_FTIME */
}
}
bool cmSystemTools::s_RunCommandHideConsole = false;
bool cmSystemTools::s_DisableRunCommandOutput = false;
bool cmSystemTools::s_ErrorOccured = false;
bool cmSystemTools::s_DisableMessages = false;
@ -251,10 +251,15 @@ void cmSystemTools::ReplaceString(std::string& source,
const char* replace,
const char* with)
{
// get out quick if string is not found
std::string::size_type start = source.find(replace);
if(start == std::string::npos)
{
return;
}
std::string rest;
std::string::size_type lengthReplace = strlen(replace);
std::string::size_type lengthWith = strlen(with);
std::string rest;
std::string::size_type start = source.find(replace);
while(start != std::string::npos)
{
rest = source.substr(start+lengthReplace);
@ -1330,7 +1335,8 @@ bool RunCommandViaWin32(const char* command,
#if defined(__BORLANDC__)
return cmWin32ProcessExecution::BorlandRunCommand(command, dir, output,
retVal,
verbose, timeout);
verbose, timeout,
cmSystemTools::GetRunCommandHideConsole());
#else // Visual studio
::SetLastError(ERROR_SUCCESS);
if ( ! command )
@ -1338,13 +1344,13 @@ bool RunCommandViaWin32(const char* command,
cmSystemTools::Error("No command specified");
return false;
}
//std::cout << "Command: " << command << std::endl;
if ( dir )
{
//std::cout << "Dir: " << dir << std::endl;
}
cmWin32ProcessExecution resProc;
if(cmSystemTools::GetRunCommandHideConsole())
{
resProc.SetHideWindows(true);
}
if ( cmSystemTools::GetWindows9xComspecSubstitute() )
{
resProc.SetConsoleSpawn(cmSystemTools::GetWindows9xComspecSubstitute() );
@ -2367,7 +2373,7 @@ bool cmSystemTools::SimpleGlob(const std::string& glob,
return res;
}
cmSystemTools::e_FileFormat cmSystemTools::GetFileFormat(const char* cext)
cmSystemTools::FileFormat cmSystemTools::GetFileFormat(const char* cext)
{
if ( ! cext || *cext == 0 )
{

View File

@ -321,7 +321,7 @@ public:
/**
* Come constants for different file formats.
*/
enum e_FileFormat {
enum FileFormat {
NO_FILE_FORMAT = 0,
C_FILE_FORMAT,
CXX_FILE_FORMAT,
@ -339,7 +339,7 @@ public:
/**
* Determine the file type based on the extension
*/
static e_FileFormat GetFileFormat(const char* ext);
static FileFormat GetFileFormat(const char* ext);
/**
* On Windows 9x we need a comspec (command.com) substitute to run
@ -349,6 +349,11 @@ public:
static void SetWindows9xComspecSubstitute(const char*);
static const char* GetWindows9xComspecSubstitute();
/** Windows if this is true, the CreateProcess in RunCommand will
* not show new consol windows when running programs.
*/
static void SetRunCommandHideConsole(bool v){s_RunCommandHideConsole = v;}
static bool GetRunCommandHideConsole(){ return s_RunCommandHideConsole;}
protected:
// these two functions can be called from ConvertToOutputPath
/**
@ -366,6 +371,7 @@ protected:
static std::string ConvertToWindowsOutputPath(const char*);
private:
static bool s_RunCommandHideConsole;
static bool s_ErrorOccured;
static bool s_DisableMessages;
static bool s_DisableRunCommandOutput;

View File

@ -135,7 +135,7 @@ int cmTryCompileCommand::CoreTryCompileCode(
}
std::string source = argv[2];
cmSystemTools::e_FileFormat format =
cmSystemTools::FileFormat format =
cmSystemTools::GetFileFormat(
cmSystemTools::GetFilenameExtension(source).c_str());
if ( format == cmSystemTools::C_FILE_FORMAT )

View File

@ -110,7 +110,7 @@ inline bool IsWinNT()
//---------------------------------------------------------------------------
bool cmWin32ProcessExecution::BorlandRunCommand(
const char* command, const char* dir,
std::string& output, int& retVal, bool verbose, int /* timeout */)
std::string& output, int& retVal, bool verbose, int /* timeout */, bool hideWindows)
{
//verbose = true;
//std::cerr << std::endl
@ -170,7 +170,11 @@ bool cmWin32ProcessExecution::BorlandRunCommand(
si.dwFlags = STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW;
si.hStdOutput = newstdout;
si.hStdError = newstdout;
si.wShowWindow = SW_SHOWDEFAULT; // SW_HIDE;
si.wShowWindow = SW_SHOWDEFAULT;
if(hideWindows)
{
si.wShowWindow = SW_HIDE;
}
//set the new handles for the child process si.hStdInput = newstdin;
char* commandAndArgs = strcpy(new char[strlen(command)+1], command);
@ -285,7 +289,8 @@ static BOOL RealPopenCreateProcess(const char *cmdstring,
HANDLE hStdin,
HANDLE hStdout,
HANDLE hStderr,
HANDLE *hProcess)
HANDLE *hProcess,
bool hideWindows)
{
PROCESS_INFORMATION piProcInfo;
STARTUPINFO siStartInfo;
@ -404,7 +409,11 @@ static BOOL RealPopenCreateProcess(const char *cmdstring,
siStartInfo.hStdInput = hStdin;
siStartInfo.hStdOutput = hStdout;
siStartInfo.hStdError = hStderr;
siStartInfo.wShowWindow = SW_SHOWDEFAULT; // SW_HIDE;
siStartInfo.wShowWindow = SW_SHOWDEFAULT;
if(hideWindows)
{
siStartInfo.wShowWindow = SW_HIDE;
}
//std::cout << "Create process: " << s2 << std::endl;
if (CreateProcess(NULL,
@ -617,7 +626,7 @@ bool cmWin32ProcessExecution::PrivateOpen(const char *cmdstring,
hChildStdinRd,
hChildStdoutWr,
hChildStdoutWr,
&hProcess))
&hProcess, m_HideWindows))
return NULL;
}
else
@ -628,7 +637,7 @@ bool cmWin32ProcessExecution::PrivateOpen(const char *cmdstring,
hChildStdinRd,
hChildStdoutWr,
hChildStderrWr,
&hProcess))
&hProcess, m_HideWindows))
return NULL;
}

View File

@ -45,9 +45,12 @@ class cmWin32ProcessExecution
public:
cmWin32ProcessExecution()
{
m_HideWindows = false;
this->SetConsoleSpawn("w9xpopen.exe");
this->Initialize();
}
///! If true windows will be created hidden.
void SetHideWindows(bool v) { m_HideWindows = v; }
/**
* Initialize the process execution datastructure. Do not call while
@ -133,7 +136,7 @@ public:
*/
static bool BorlandRunCommand(const char* command, const char* dir,
std::string& output, int& retVal, bool verbose,
int timeout);
int timeout, bool hideWindows);
private:
bool PrivateOpen(const char*, const char*, int, int);
@ -156,6 +159,7 @@ private:
std::string m_Output;
std::string m_ConsoleSpawn;
bool m_Verbose;
bool m_HideWindows;
};

View File

@ -195,6 +195,10 @@ void ctest::Initialize()
fin.getline(buffer, 1023);
buffer[1023] = 0;
std::string line = ::CleanString(buffer);
if(line.size() == 0)
{
continue;
}
while ( fin && (line[line.size()-1] == '\\') )
{
line = line.substr(0, line.size()-1);
@ -207,10 +211,6 @@ void ctest::Initialize()
{
continue;
}
if ( line.size() == 0 )
{
continue;
}
std::string::size_type cpos = line.find_first_of(":");
if ( cpos == line.npos )
{