Added cl compiler flags + new DartConfig

This commit is contained in:
tlegrand 2008-02-14 08:28:47 +00:00
commit af0f4fdd42

View file

@ -8,7 +8,6 @@ INCLUDE(eo-conf.cmake OPTIONAL)
######################################################################################
######################################################################################
### 1) Main project config
######################################################################################
@ -38,7 +37,7 @@ ENABLE_LANGUAGE(C)
#####################################################################################
### 2) Include required modules
### 2) Include required modules / configuration files
#####################################################################################
INCLUDE(CMakeBackwardCompatibilityCXX)
@ -50,8 +49,13 @@ INCLUDE(CheckLibraryExists)
INCLUDE(ConfigureChecks.cmake)
INCLUDE(Dart OPTIONNAL)
# the project can have a DartConfig.cmake file
INCLUDE(DartConfig.cmake OPTIONNAL)
# now create config headers
configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h )
configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
# Set a special flag if the environment is windows (should do the same in a config.g file)
IF (WIN32)
@ -59,49 +63,70 @@ IF (WIN32)
ENDIF (WIN32)
######################################################################################
#####################################################################################
### 3) Manage the build type
#####################################################################################
# the user should choose the build type on windows environments,excepted under cygwin (default=none)
SET(CMAKE_DEFAULT_BUILD_TYPE "" CACHE STRING "Variable that stores the default CMake build type" FORCE)
SET(CMAKE_DEFAULT_BUILD_TYPE "Release" CACHE STRING "Variable that stores the default CMake build type" FORCE)
IF(WIN32 AND NOT CYGWIN)
IF(NOT CMAKE_BUILD_TYPE)
FIND_PROGRAM(MEMORYCHECK_COMMAND
NAMES purify valgrind
PATHS
"/usr/local/bin /usr/bin [HKEY_LOCAL_MACHINE\\SOFTWARE\\Rational Software\\Purify\\Setup;InstallFolder]"
DOC "Path to the memory checking command, used for memory error detection.")
IF(NOT CMAKE_BUILD_TYPE)
SET( CMAKE_BUILD_TYPE
${CMAKE_DEFAULT_BUILD_TYPE} CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)
MESSAGE(STATUS "")
MESSAGE(STATUS "Warning: The type of build is: ${CMAKE_BUILD_TYPE}.")
MESSAGE(STATUS "The available types are: None Debug Release RelWithDebInfo MinSizeRel.")
MESSAGE(STATUS "You can choose it with: cmake <path-to-source> -D<build-type>")
MESSAGE(STATUS "")
ENDIF(NOT CMAKE_BUILD_TYPE)
IF(WIN32 AND NOT CYGWIN)
IF(CMAKE_CXX_COMPILER MATCHES cl)
IF(NOT WITH_SHARED_LIBS)
IF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005")
SET(CMAKE_CXX_FLAGS "/nologo /W3 /Gy")
SET(CMAKE_CXX_FLAGS_DEBUG "/MTd /Z7 /Od")
SET(CMAKE_CXX_FLAGS_RELEASE "/MT /O2")
SET(CMAKE_CXX_FLAGS_MINSIZEREL "/MT /O2")
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MTd /Z7 /Od")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:CONSOLE")
ENDIF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005")
ENDIF(NOT WITH_SHARED_LIBS)
ENDIF(CMAKE_CXX_COMPILER MATCHES cl)
ELSE(WIN32 AND NOT CYGWIN)
IF(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g -Wall -pedantic -Wextra -Wno-import -Winit-self -Wmissing-include-dirs -Wunused-parameter -Wundef -Wshadow -Wunsafe-loop-optimizations -Wcast-align -Wconversion -Wsign-compare -Winline -Wdisabled-optimization")
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2")
SET(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -O6")
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
ENDIF(WIN32 AND NOT CYGWIN)
IF(CMAKE_BUILD_TYPE MATCHES Debug)
ADD_DEFINITIONS(-DCMAKE_VERBOSE_MAKEFILE=ON)
ENDIF(CMAKE_BUILD_TYPE MATCHES Debug)
#####################################################################################
######################################################################################
### 3) Where must cmake go now ?
######################################################################################
SUBDIRS(app doc src test tutorial)
######################################################################################
######################################################################################
### 4) Test config
######################################################################################
#SET(ENABLE_CMAKE_TESTING TRUE CACHE BOOL "Enable testing ?")
IF (ENABLE_CMAKE_TESTING)
ENABLE_TESTING()
IF (ENABLE_CMAKE_TESTING)
ENABLE_TESTING()
ENDIF (ENABLE_CMAKE_TESTING)
######################################################################################
######################################################################################
### 5) Where must cmake go now ?
######################################################################################
SUBDIRS(app doc src test tutorial)
######################################################################################