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.

This commit is contained in:
Brad King 2002-11-08 18:06:53 -05:00
parent c74ce9b218
commit 3a6d52f4c5
8 changed files with 54 additions and 102 deletions

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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 ":")

View File

@ -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.")

View File

@ -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.")

View File

@ -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 "")