diff options
-rw-r--r-- | Modules/CMakeBackwardCompatibilityC.cmake | 1 | ||||
-rw-r--r-- | Modules/CMakeCCompiler.cmake.in | 1 | ||||
-rw-r--r-- | Modules/CMakeCXXCompiler.cmake.in | 2 | ||||
-rw-r--r-- | Modules/CMakeSystem.cmake.in | 2 | ||||
-rw-r--r-- | Modules/CMakeSystemSpecificInformation.cmake | 41 | ||||
-rw-r--r-- | Modules/Platform/HP-UX.cmake | 17 | ||||
-rw-r--r-- | Modules/Platform/IRIX.cmake | 16 | ||||
-rw-r--r-- | Modules/Platform/IRIX64.cmake | 16 | ||||
-rw-r--r-- | Modules/Platform/Windows-bcc32.cmake | 16 | ||||
-rw-r--r-- | Modules/Platform/Windows-cl.cmake | 16 | ||||
-rw-r--r-- | Modules/Platform/gcc.cmake | 17 | ||||
-rw-r--r-- | Source/TODO | 2 | ||||
-rw-r--r-- | Source/cmGlobalUnixMakefileGenerator.cxx | 21 |
13 files changed, 92 insertions, 76 deletions
diff --git a/Modules/CMakeBackwardCompatibilityC.cmake b/Modules/CMakeBackwardCompatibilityC.cmake index 1bb8396..a41cc1c 100644 --- a/Modules/CMakeBackwardCompatibilityC.cmake +++ b/Modules/CMakeBackwardCompatibilityC.cmake @@ -25,3 +25,4 @@ CHECK_INCLUDE_FILE("pthread.h" CMAKE_HAVE_PTHREAD_H) INCLUDE (${CMAKE_ROOT}/Modules/TestBigEndian.cmake) TEST_BIG_ENDIAN(CMAKE_WORDS_BIGENDIAN) +INCLUDE (${CMAKE_ROOT}/Modules/FindX11.cmake) diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in index ffc0b0f..f22fc2a 100644 --- a/Modules/CMakeCCompiler.cmake.in +++ b/Modules/CMakeCCompiler.cmake.in @@ -2,4 +2,5 @@ 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@) +SET(CMAKE_C_COMPILER_LOADED 1) diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in index c86408b..6dcba48 100644 --- a/Modules/CMakeCXXCompiler.cmake.in +++ b/Modules/CMakeCXXCompiler.cmake.in @@ -1,2 +1,4 @@ SET(CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@") SET(CMAKE_COMPILER_IS_GNUCXX @CMAKE_COMPILER_IS_GNUCXX@) +SET(CMAKE_CXX_COMPILER_LOADED 1) + diff --git a/Modules/CMakeSystem.cmake.in b/Modules/CMakeSystem.cmake.in index f1d4ff1..1697b35 100644 --- a/Modules/CMakeSystem.cmake.in +++ b/Modules/CMakeSystem.cmake.in @@ -1,4 +1,4 @@ SET(CMAKE_SYSTEM "@CMAKE_SYSTEM@") SET(CMAKE_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@") SET(CMAKE_SYSTEM_VERSION "@CMAKE_SYSTEM_VERSION@") - +SET(CMAKE_SYSTEM_LOADED 1) diff --git a/Modules/CMakeSystemSpecificInformation.cmake b/Modules/CMakeSystemSpecificInformation.cmake index c641f19..0002aea 100644 --- a/Modules/CMakeSystemSpecificInformation.cmake +++ b/Modules/CMakeSystemSpecificInformation.cmake @@ -85,6 +85,9 @@ IF(NOT CMAKE_MODULE_EXISTS) ENDIF(NOT CMAKE_MODULE_EXISTS) +# Create a set of shared library variable specific to C++ +# For 90% of the systems, these are the same flags as the C versions +# so if these are not set just copy the flags from the c version 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) @@ -105,6 +108,26 @@ 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) +# repeat for modules +IF(NOT CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS) + SET(CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS ${CMAKE_SHARED_MODULE_CREATE_C_FLAGS}) +ENDIF(NOT CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS) + +IF(NOT CMAKE_SHARED_MODULE_CXX_FLAGS) + SET(CMAKE_SHARED_MODULE_CXX_FLAGS ${CMAKE_SHARED_MODULE_C_FLAGS}) +ENDIF(NOT CMAKE_SHARED_MODULE_CXX_FLAGS) + +IF(NOT CMAKE_SHARED_MODULE_LINK_CXX_FLAGS) + SET(CMAKE_SHARED_MODULE_LINK_CXX_FLAGS ${CMAKE_SHARED_MODULE_LINK_FLAGS}) +ENDIF(NOT CMAKE_SHARED_MODULE_LINK_CXX_FLAGS) + +IF(NOT CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG) + SET(CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG ${CMAKE_SHARED_MODULE_RUNTIME_FLAG}) +ENDIF(NOT CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG) + +IF(NOT CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG_SEP) + SET(CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG_SEP ${CMAKE_SHARED_MODULE_RUNTIME_FLAG_SEP}) +ENDIF(NOT CMAKE_SHARED_MODULE_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 @@ -121,18 +144,21 @@ SET(CMAKE_VERBOSE_MAKEFILE FALSE CACHE BOOL "If this value is on, makefiles will 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.") -# Add these settings to the cache. -SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING +# add the flags to the cache based +# on the initial values computed in the platform/*.cmake files +# use _INIT variables so that this only happens the first time +# and you can set these flags in the cmake cache +SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_INIT}" CACHE STRING "Flags used by the compiler during all build types.") -SET (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING +SET (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG_INIT}" CACHE STRING "Flags used by the compiler during debug builds.") -SET (CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL}" CACHE STRING +SET (CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL_INIT}" CACHE STRING "Flags used by the compiler during release minsize builds.") -SET (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}" CACHE STRING +SET (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE_INIT}" 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 "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" CACHE STRING +SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING "Flags used by the compiler during Release with Debug Info builds.") -SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING +SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS_INIT}" CACHE STRING "Flags for C compiler.") MARK_AS_ADVANCED( @@ -144,3 +170,4 @@ CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_DEBUG CMAKE_C_FLAGS ) +SET(CMAKE_SYSTEM_SPECIFIC_INFORMATION_LOADED 1) diff --git a/Modules/Platform/HP-UX.cmake b/Modules/Platform/HP-UX.cmake index 24f9441..6af9a1c 100644 --- a/Modules/Platform/HP-UX.cmake +++ b/Modules/Platform/HP-UX.cmake @@ -41,14 +41,11 @@ ELSE(CMAKE_COMPILER_IS_GNUCXX) SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-Wl,+b") # -rpath SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fPIC") # -pic - IF(NOT CMAKE_CXX_FLAGS) - SET (CMAKE_CXX_FLAGS "") - SET (CMAKE_CXX_FLAGS_DEBUG "-g") - SET (CMAKE_CXX_FLAGS_MINSIZEREL "-O3") - SET (CMAKE_CXX_FLAGS_RELEASE "-O2") - SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g") - ENDIF(NOT CMAKE_CXX_FLAGS) - IF(NOT CMAKE_C_FLAGS) - SET (CMAKE_C_FLAGS "") - ENDIF(NOT CMAKE_C_FLAGS) + SET (CMAKE_CXX_FLAGS_INIT "") + SET (CMAKE_CXX_FLAGS_DEBUG_INIT "-g") + SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-O3") + SET (CMAKE_CXX_FLAGS_RELEASE_INIT "-O2") + SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-g") + SET (CMAKE_C_FLAGS_INIT "") + ENDIF(CMAKE_COMPILER_IS_GNUCXX) diff --git a/Modules/Platform/IRIX.cmake b/Modules/Platform/IRIX.cmake index 2df5dad..8f78f02 100644 --- a/Modules/Platform/IRIX.cmake +++ b/Modules/Platform/IRIX.cmake @@ -6,16 +6,12 @@ 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>") - IF(NOT CMAKE_CXX_FLAGS) - SET (CMAKE_CXX_FLAGS "") - SET (CMAKE_CXX_FLAGS_DEBUG "-g") - SET (CMAKE_CXX_FLAGS_MINSIZEREL "-O3") - SET (CMAKE_CXX_FLAGS_RELEASE "-O2") - SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2") - ENDIF(NOT CMAKE_CXX_FLAGS) - IF(NOT CMAKE_C_FLAGS) - SET (CMAKE_C_FLAGS "") - ENDIF(NOT CMAKE_C_FLAGS) + SET (CMAKE_CXX_FLAGS_INIT "") + SET (CMAKE_CXX_FLAGS_DEBUG_INIT "-g") + SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-O3") + SET (CMAKE_CXX_FLAGS_RELEASE_INIT "-O2") + SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2") + SET (CMAKE_C_FLAGS_INIT "") ELSE(NOT CMAKE_COMPILER_IS_GNUCXX) INCLUDE(${CMAKE_ROOT}/Modules/Platform/gcc.cmake) ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX) diff --git a/Modules/Platform/IRIX64.cmake b/Modules/Platform/IRIX64.cmake index aa5f1b8..0caf9ab 100644 --- a/Modules/Platform/IRIX64.cmake +++ b/Modules/Platform/IRIX64.cmake @@ -7,16 +7,12 @@ 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) - IF(NOT CMAKE_CXX_FLAGS) - SET (CMAKE_CXX_FLAGS "") - SET (CMAKE_CXX_FLAGS_DEBUG "-g") - SET (CMAKE_CXX_FLAGS_MINSIZEREL "-O3") - SET (CMAKE_CXX_FLAGS_RELEASE "-O2") - SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2") - ENDIF(NOT CMAKE_CXX_FLAGS) - IF(NOT CMAKE_C_FLAGS) - SET (CMAKE_C_FLAGS "") - ENDIF(NOT CMAKE_C_FLAGS) + SET (CMAKE_CXX_FLAGS_INIT "") + SET (CMAKE_CXX_FLAGS_DEBUG_INIT "-g") + SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-O3") + SET (CMAKE_CXX_FLAGS_RELEASE_INIT "-O2") + SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2") + SET (CMAKE_C_FLAGS_INIT "") ELSE(NOT CMAKE_COMPILER_IS_GNUCXX) INCLUDE(${CMAKE_ROOT}/Modules/Platform/gcc.cmake) ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX) diff --git a/Modules/Platform/Windows-bcc32.cmake b/Modules/Platform/Windows-bcc32.cmake index 4d1b19d..b00ac1c 100644 --- a/Modules/Platform/Windows-bcc32.cmake +++ b/Modules/Platform/Windows-bcc32.cmake @@ -49,16 +49,12 @@ SET(CMAKE_CREATE_WIN32_EXE -tW -tWM ) # extra flags for a console app SET(CMAKE_CREATE_CONSOLE_EXE -tWC ) -IF(NOT CMAKE_CXX_FLAGS) - SET (CMAKE_CXX_FLAGS "-w- -whid -waus -wpar -tWM -P") - SET (CMAKE_CXX_FLAGS_DEBUG "-Od -v") - SET (CMAKE_CXX_FLAGS_MINSIZEREL "-O1") - SET (CMAKE_CXX_FLAGS_RELEASE "-O2") - SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Od") -ENDIF(NOT CMAKE_CXX_FLAGS) -IF(NOT CMAKE_C_FLAGS) - SET (CMAKE_C_FLAGS "-w- -whid -waus -tWM") -ENDIF(NOT CMAKE_C_FLAGS) +SET (CMAKE_CXX_FLAGS_INIT "-w- -whid -waus -wpar -tWM -P") +SET (CMAKE_CXX_FLAGS_DEBUG_INIT "-Od -v") +SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-O1") +SET (CMAKE_CXX_FLAGS_RELEASE_INIT "-O2") +SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-Od") +SET (CMAKE_C_FLAGS_INIT "-w- -whid -waus -tWM") SET (CMAKE_STANDARD_LIBRARIES "import32.lib" CACHE STRING diff --git a/Modules/Platform/Windows-cl.cmake b/Modules/Platform/Windows-cl.cmake index c1f975b..466632e 100644 --- a/Modules/Platform/Windows-cl.cmake +++ b/Modules/Platform/Windows-cl.cmake @@ -42,16 +42,12 @@ SET (CMAKE_BUILD_TYPE Debug CACHE STRING SET(CMAKE_CREATE_WIN32_EXE /subsystem:windows) -IF(NOT CMAKE_CXX_FLAGS) - SET (CMAKE_CXX_FLAGS "/nologo /W3 /Zm1000 /GX /GR") - SET (CMAKE_CXX_FLAGS_DEBUG "/MDd /Zi /Od /GZ") - SET (CMAKE_CXX_FLAGS_MINSIZEREL "/MD /O1") - SET (CMAKE_CXX_FLAGS_RELEASE "/MD /O2") - SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MD /Zi /O2") -ENDIF(NOT CMAKE_CXX_FLAGS) -IF(NOT CMAKE_C_FLAGS) - SET (CMAKE_C_FLAGS "/nologo /W3 /Zm1000") -ENDIF(NOT CMAKE_C_FLAGS) +SET (CMAKE_CXX_FLAGS_INIT "/nologo /W3 /Zm1000 /GX /GR") +SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/MDd /Zi /Od /GZ") +SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1") +SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2") +SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2") +SET (CMAKE_C_FLAGS_INIT "/nologo /W3 /Zm1000") 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 diff --git a/Modules/Platform/gcc.cmake b/Modules/Platform/gcc.cmake index c03b282..0029d2e 100644 --- a/Modules/Platform/gcc.cmake +++ b/Modules/Platform/gcc.cmake @@ -1,11 +1,6 @@ -IF(NOT CMAKE_CXX_FLAGS) - SET (CMAKE_CXX_FLAGS "") - SET (CMAKE_CXX_FLAGS_DEBUG "-g") - SET (CMAKE_CXX_FLAGS_MINSIZEREL "-O3") - SET (CMAKE_CXX_FLAGS_RELEASE "-O2") - SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g") -ENDIF(NOT CMAKE_CXX_FLAGS) - -IF(NOT CMAKE_C_FLAGS) - SET (CMAKE_C_FLAGS "") -ENDIF(NOT CMAKE_C_FLAGS) +SET (CMAKE_CXX_FLAGS_INIT "") +SET (CMAKE_CXX_FLAGS_DEBUG_INIT "-g") +SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-O3") +SET (CMAKE_CXX_FLAGS_RELEASE_INIT "-O2") +SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -g") +SET (CMAKE_C_FLAGS_INIT "") diff --git a/Source/TODO b/Source/TODO index 32ff833..ce0fbbd 100644 --- a/Source/TODO +++ b/Source/TODO @@ -1,3 +1,5 @@ +link flags + Variables: CMAKE_SYSTEM diff --git a/Source/cmGlobalUnixMakefileGenerator.cxx b/Source/cmGlobalUnixMakefileGenerator.cxx index aeb3e41..cccbaef 100644 --- a/Source/cmGlobalUnixMakefileGenerator.cxx +++ b/Source/cmGlobalUnixMakefileGenerator.cxx @@ -76,24 +76,31 @@ void cmGlobalUnixMakefileGenerator::EnableLanguage(const char* lang, std::string fpath = rootBin; - fpath += "/CMakeSystem.cmake"; - mf->ReadListFile(0,fpath.c_str()); + if(!mf->GetDefinition("CMAKE_SYSTEM_LOADED")) + { + fpath += "/CMakeSystem.cmake"; + mf->ReadListFile(0,fpath.c_str()); + } // if C, then enable C - if(lang[0] == 'C') + if(lang[0] == 'C' && !mf->GetDefinition("CMAKE_C_COMPILER_LOADED")) { fpath = rootBin; fpath += "/CMakeCCompiler.cmake"; mf->ReadListFile(0,fpath.c_str()); } - if(strcmp(lang, "CXX") == 0) + if(strcmp(lang, "CXX") == 0 && !mf->GetDefinition("CMAKE_CXX_COMPILER_LOADED")) { fpath = rootBin; fpath += "/CMakeCXXCompiler.cmake"; mf->ReadListFile(0,fpath.c_str()); } - fpath = root; - fpath += "/Modules/CMakeSystemSpecificInformation.cmake"; - mf->ReadListFile(0,fpath.c_str()); + if(!mf->GetDefinition("CMAKE_SYSTEM_SPECIFIC_INFORMATION_LOADED")) + { + 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 |