CMakeLists.txt
changeset 1204 736a341e604b
parent 1198 2236d00ca778
equal deleted inserted replaced
77:62361d428fed 78:f510fc78e24a
     3 IF(POLICY CMP0048) 
     3 IF(POLICY CMP0048) 
     4   CMAKE_POLICY(SET CMP0048 OLD) 
     4   CMAKE_POLICY(SET CMP0048 OLD) 
     5 ENDIF(POLICY CMP0048)
     5 ENDIF(POLICY CMP0048)
     6 
     6 
     7 IF(POLICY CMP0043) 
     7 IF(POLICY CMP0043) 
     8   CMAKE_POLICY(SET CMP0043 OLD) 
     8   CMAKE_POLICY(SET CMP0043 NEW)
     9 ENDIF(POLICY CMP0043)
     9 ENDIF(POLICY CMP0043)
    10 
    10 
    11 IF(POLICY CMP0026)
    11 IF(POLICY CMP0026)
    12   #This is for copying the dll's needed by glpk (in lp_test and mip_test)
    12   #This is for copying the dll's needed by glpk (in lp_test and mip_test)
    13   CMAKE_POLICY(SET CMP0026 OLD) 
    13   CMAKE_POLICY(SET CMP0026 NEW)
    14 ENDIF(POLICY CMP0026)
    14 ENDIF(POLICY CMP0026)
    15 
    15 
    16 SET(PROJECT_NAME "LEMON")
    16 SET(PROJECT_NAME "LEMON")
    17 PROJECT(${PROJECT_NAME})
    17 PROJECT(${PROJECT_NAME})
    18 
    18 
   194 SET(LEMON_CXX_WARNING_FLAGS ${CXX_WARNING} CACHE STRING "LEMON warning flags.")
   194 SET(LEMON_CXX_WARNING_FLAGS ${CXX_WARNING} CACHE STRING "LEMON warning flags.")
   195 
   195 
   196 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LEMON_CXX_WARNING_FLAGS}")
   196 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LEMON_CXX_WARNING_FLAGS}")
   197 
   197 
   198 IF(MSVC)
   198 IF(MSVC)
   199   SET(CMAKE_CXX_FLAGS "/bigobj ${CMAKE_CXX_FLAGS}")
   199   SET( CMAKE_CXX_FLAGS "/bigobj ${CMAKE_CXX_FLAGS}")
   200   SET( CMAKE_CXX_FLAGS_MAINTAINER "/WX ${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING
   200   SET( CMAKE_CXX_FLAGS_MAINTAINER "/WX ${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING
   201     "Flags used by the C++ compiler during maintainer builds."
   201     "Flags used by the C++ compiler during maintainer builds." FORCE
   202     )
   202     )
   203   SET( CMAKE_C_FLAGS_MAINTAINER "/WX ${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING
   203   SET( CMAKE_C_FLAGS_MAINTAINER "/WX ${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING
   204     "Flags used by the C compiler during maintainer builds."
   204     "Flags used by the C compiler during maintainer builds." FORCE
   205     )
   205     )
   206   SET( CMAKE_EXE_LINKER_FLAGS_MAINTAINER
   206   SET( CMAKE_EXE_LINKER_FLAGS_MAINTAINER
   207     "${CMAKE_EXE_LINKER_FLAGS_DEBUG}" CACHE STRING
   207     "${CMAKE_EXE_LINKER_FLAGS_DEBUG}" CACHE STRING
   208     "Flags used for linking binaries during maintainer builds."
   208     "Flags used for linking binaries during maintainer builds." FORCE
   209     )
   209     )
   210   SET( CMAKE_SHARED_LINKER_FLAGS_MAINTAINER
   210   SET( CMAKE_SHARED_LINKER_FLAGS_MAINTAINER
   211     "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" CACHE STRING
   211     "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" CACHE STRING
   212     "Flags used by the shared libraries linker during maintainer builds."
   212     "Flags used by the shared libraries linker during maintainer builds."
       
   213      FORCE
   213     )
   214     )
   214 ELSE()
   215 ELSE()
   215   SET( CMAKE_CXX_FLAGS_MAINTAINER "-Werror -ggdb -O0" CACHE STRING
   216   SET( CMAKE_CXX_FLAGS_MAINTAINER "-Werror -ggdb -O0" CACHE STRING
   216     "Flags used by the C++ compiler during maintainer builds."
   217     "Flags used by the C++ compiler during maintainer builds." FORCE
   217     )
   218     )
   218   SET( CMAKE_C_FLAGS_MAINTAINER "-Werror -O0" CACHE STRING
   219   SET( CMAKE_C_FLAGS_MAINTAINER "-Werror -O0" CACHE STRING
   219     "Flags used by the C compiler during maintainer builds."
   220     "Flags used by the C compiler during maintainer builds." FORCE
   220     )
   221     )
   221   SET( CMAKE_EXE_LINKER_FLAGS_MAINTAINER
   222   SET( CMAKE_EXE_LINKER_FLAGS_MAINTAINER
   222     "${CMAKE_EXE_LINKER_FLAGS_DEBUG}" CACHE STRING
   223     "${CMAKE_EXE_LINKER_FLAGS_DEBUG}" CACHE STRING
   223     "Flags used for linking binaries during maintainer builds."
   224     "Flags used for linking binaries during maintainer builds." FORCE
   224     )
   225     )
   225   SET( CMAKE_SHARED_LINKER_FLAGS_MAINTAINER
   226   SET( CMAKE_SHARED_LINKER_FLAGS_MAINTAINER
   226     "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" CACHE STRING
   227     "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" CACHE STRING
   227     "Flags used by the shared libraries linker during maintainer builds."
   228     "Flags used by the shared libraries linker during maintainer builds." FORCE)
   228     )
       
   229 ENDIF()
   229 ENDIF()
   230 
   230 
   231 MARK_AS_ADVANCED(
   231 MARK_AS_ADVANCED(
   232     CMAKE_CXX_FLAGS_MAINTAINER
   232     CMAKE_CXX_FLAGS_MAINTAINER
   233     CMAKE_C_FLAGS_MAINTAINER
   233     CMAKE_C_FLAGS_MAINTAINER
   249 SET( CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING
   249 SET( CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING
   250     "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel Maintainer."
   250     "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel Maintainer."
   251     FORCE )
   251     FORCE )
   252 
   252 
   253 SET_DIRECTORY_PROPERTIES(PROPERTIES
   253 SET_DIRECTORY_PROPERTIES(PROPERTIES
   254   COMPILE_DEFINITIONS_DEBUG "LEMON_ENABLE_DEBUG"
   254   COMPILE_DEFINITIONS
   255   COMPILE_DEFINITIONS_MAINTAINER "LEMON_ENABLE_DEBUG"
   255   $<$<OR:$<CONFIG:Debug>,$<CONFIG:Maintainer>>:LEMON_ENABLE_DEBUG>
   256 )
   256 )
   257 
   257 
   258 INCLUDE(CheckTypeSize)
   258 INCLUDE(CheckTypeSize)
   259 CHECK_TYPE_SIZE("long long" LONG_LONG)
   259 CHECK_TYPE_SIZE("long long" LONG_LONG)
   260 SET(LEMON_HAVE_LONG_LONG ${HAVE_LONG_LONG})
   260 SET(LEMON_HAVE_LONG_LONG ${HAVE_LONG_LONG})