clean up flags with _init flags

This commit is contained in:
Bill Hoffman 2002-11-11 12:31:46 -05:00
parent 5b9a880bfb
commit d1051bb575
13 changed files with 92 additions and 76 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,3 +1,5 @@
link flags
Variables:
CMAKE_SYSTEM

View File

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