diff options
author | Brad King <brad.king@kitware.com> | 2002-11-08 23:06:53 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2002-11-08 23:06:53 (GMT) |
commit | 3a6d52f4c5a2cf7bb0fd0ec0e46cf1802d82c77b (patch) | |
tree | 88bd3a8bd7c60b350b8f706f46a6d6f82b5e2088 | |
parent | c74ce9b21852bfd93d7d13ba70e11967b94a8300 (diff) | |
download | CMake-3a6d52f4c5a2cf7bb0fd0ec0e46cf1802d82c77b.zip CMake-3a6d52f4c5a2cf7bb0fd0ec0e46cf1802d82c77b.tar.gz CMake-3a6d52f4c5a2cf7bb0fd0ec0e46cf1802d82c77b.tar.bz2 |
ENH: Moved caching of C*_FLAGS* settings down to CMakeSystemSpecificInformation.cmake. The platform files can set the defaults on the first run, and then the settings are cached at the end.
-rw-r--r-- | Modules/CMakeSystemSpecificInformation.cmake | 15 | ||||
-rw-r--r-- | Modules/Platform/HP-UX.cmake | 18 | ||||
-rw-r--r-- | Modules/Platform/IRIX.cmake | 23 | ||||
-rw-r--r-- | Modules/Platform/IRIX64.cmake | 24 | ||||
-rw-r--r-- | Modules/Platform/Linux.cmake | 4 | ||||
-rw-r--r-- | Modules/Platform/Windows-bcc32.cmake | 24 | ||||
-rw-r--r-- | Modules/Platform/Windows-cl.cmake | 24 | ||||
-rw-r--r-- | Modules/Platform/gcc.cmake | 24 |
8 files changed, 54 insertions, 102 deletions
diff --git a/Modules/CMakeSystemSpecificInformation.cmake b/Modules/CMakeSystemSpecificInformation.cmake index 4d76f89..c641f19 100644 --- a/Modules/CMakeSystemSpecificInformation.cmake +++ b/Modules/CMakeSystemSpecificInformation.cmake @@ -120,6 +120,21 @@ SET(CMAKE_VERBOSE_MAKEFILE FALSE CACHE BOOL "If this value is on, makefiles will # 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.") + +# Add these settings to the cache. +SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING + "Flags used by the compiler during all build types.") +SET (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING + "Flags used by the compiler during debug builds.") +SET (CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL}" CACHE STRING + "Flags used by the compiler during release minsize builds.") +SET (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}" 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 + "Flags used by the compiler during Release with Debug Info builds.") +SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING + "Flags for C compiler.") + MARK_AS_ADVANCED( CMAKE_VERBOSE_MAKEFILE CMAKE_CXX_FLAGS diff --git a/Modules/Platform/HP-UX.cmake b/Modules/Platform/HP-UX.cmake index 0f123b0..ebc370a 100644 --- a/Modules/Platform/HP-UX.cmake +++ b/Modules/Platform/HP-UX.cmake @@ -41,17 +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 - 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.") + 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") + SET (CMAKE_C_FLAGS "") ENDIF(CMAKE_COMPILER_IS_GNUCXX) diff --git a/Modules/Platform/IRIX.cmake b/Modules/Platform/IRIX.cmake index 62c374c..8c720ab 100644 --- a/Modules/Platform/IRIX.cmake +++ b/Modules/Platform/IRIX.cmake @@ -6,23 +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>") - 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.") + 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") + SET (CMAKE_C_FLAGS "") 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 5ff1065..eed0e2a 100644 --- a/Modules/Platform/IRIX64.cmake +++ b/Modules/Platform/IRIX64.cmake @@ -7,24 +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) - 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.") + 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") + SET (CMAKE_C_FLAGS "") ELSE(NOT CMAKE_COMPILER_IS_GNUCXX) INCLUDE(${CMAKE_ROOT}/Modules/Platform/gcc.cmake) ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX) diff --git a/Modules/Platform/Linux.cmake b/Modules/Platform/Linux.cmake index b3091b7..2085c93 100644 --- a/Modules/Platform/Linux.cmake +++ b/Modules/Platform/Linux.cmake @@ -1,7 +1,9 @@ +# GCC is the default compiler on Linux. +INCLUDE(${CMAKE_ROOT}/Modules/Platform/gcc.cmake) + 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 ":") - diff --git a/Modules/Platform/Windows-bcc32.cmake b/Modules/Platform/Windows-bcc32.cmake index 744e44c..4b2028f 100644 --- a/Modules/Platform/Windows-bcc32.cmake +++ b/Modules/Platform/Windows-bcc32.cmake @@ -49,24 +49,12 @@ 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_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") +SET (CMAKE_C_FLAGS "-w- -whid -waus -tWM") SET (CMAKE_STANDARD_LIBRARIES "import32.lib" CACHE STRING "Libraries linked by defalut with all applications.") diff --git a/Modules/Platform/Windows-cl.cmake b/Modules/Platform/Windows-cl.cmake index bf274fa..0881bf4 100644 --- a/Modules/Platform/Windows-cl.cmake +++ b/Modules/Platform/Windows-cl.cmake @@ -42,24 +42,12 @@ SET (CMAKE_BUILD_TYPE Debug CACHE STRING 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_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") +SET (CMAKE_C_FLAGS "/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 "Libraries linked by defalut with all applications.") diff --git a/Modules/Platform/gcc.cmake b/Modules/Platform/gcc.cmake index 55612bd..62b3c2e 100644 --- a/Modules/Platform/gcc.cmake +++ b/Modules/Platform/gcc.cmake @@ -1,18 +1,6 @@ -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.") +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") +SET (CMAKE_C_FLAGS "") |