Make CMAKE config more consistent with configure.ac (#390)
authorAlpar Juttner <alpar@cs.elte.hu>
Thu, 09 Sep 2010 15:55:00 +0200
changeset 900659ba4805a48
parent 899 7d166b8b8018
child 901 63e4468c680e
Make CMAKE config more consistent with configure.ac (#390)

- CMAKE_BUILD_TYPE is Release by deafult
- The same set of warnings are used when compiling with gcc
CMakeLists.txt
     1.1 --- a/CMakeLists.txt	Fri Sep 03 15:37:19 2010 +0200
     1.2 +++ b/CMakeLists.txt	Thu Sep 09 15:55:00 2010 +0200
     1.3 @@ -46,6 +46,37 @@
     1.4  FIND_PACKAGE(CPLEX)
     1.5  FIND_PACKAGE(COIN)
     1.6  
     1.7 +IF(DEFINED ENV{LEMON_CXX_WARNING})
     1.8 +  SET(CXX_WARNING $ENV{LEMON_CXX_WARNING})
     1.9 +ELSE()
    1.10 +  IF(CMAKE_COMPILER_IS_GNUCXX)
    1.11 +    SET(CXX_WARNING "-Wall -W -Wunused -Wformat=2 -Wctor-dtor-privacy -Wnon-virtual-dtor -Wno-char-subscripts -Wwrite-strings -Wno-char-subscripts -Wreturn-type -Wcast-qual -Wcast-align -Wsign-promo -Woverloaded-virtual -ansi -fno-strict-aliasing -Wold-style-cast -Wno-unknown-pragmas")
    1.12 +    SET(CMAKE_CXX_FLAGS_DEBUG CACHE STRING "-ggdb")
    1.13 +    SET(CMAKE_C_FLAGS_DEBUG CACHE STRING "-ggdb")
    1.14 +  ELSEIF(MSVC)
    1.15 +    # This part is unnecessary 'casue the same is set by the lemon/core.h.
    1.16 +    # Still keep it as an example.
    1.17 +    SET(CXX_WARNING "/wd4250 /wd4355 /wd4503 /wd4800 /wd4996")
    1.18 +    # Suppressed warnings:
    1.19 +    # C4250: 'class1' : inherits 'class2::member' via dominance
    1.20 +    # C4355: 'this' : used in base member initializer list
    1.21 +    # C4503: 'function' : decorated name length exceeded, name was truncated
    1.22 +    # C4800: 'type' : forcing value to bool 'true' or 'false'
    1.23 +    #        (performance warning)
    1.24 +    # C4996: 'function': was declared deprecated
    1.25 +  ELSE()
    1.26 +    SET(CXX_WARNING "-Wall -W")
    1.27 +  ENDIF()
    1.28 +ENDIF()
    1.29 +SET(LEMON_CXX_WARNING_FLAGS ${CXX_WARNING} CACHE STRING "LEMON warning flags.")
    1.30 +
    1.31 +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LEMON_CXX_WARNING_FLAGS}")
    1.32 +
    1.33 +IF(NOT CMAKE_BUILD_TYPE)
    1.34 +  SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE)
    1.35 +ENDIF()
    1.36 +
    1.37 +
    1.38  INCLUDE(CheckTypeSize)
    1.39  CHECK_TYPE_SIZE("long long" LONG_LONG)
    1.40  SET(LEMON_HAVE_LONG_LONG ${HAVE_LONG_LONG})