[Lemon-commits] Alpar Juttner: Make CMAKE config more consistent...
Lemon HG
hg at lemon.cs.elte.hu
Sun Sep 12 07:03:36 CEST 2010
details: http://lemon.cs.elte.hu/hg/lemon/rev/659ba4805a48
changeset: 995:659ba4805a48
user: Alpar Juttner <alpar [at] cs.elte.hu>
date: Thu Sep 09 15:55:00 2010 +0200
description:
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
diffstat:
CMakeLists.txt | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
diffs (41 lines):
diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -46,6 +46,37 @@
FIND_PACKAGE(CPLEX)
FIND_PACKAGE(COIN)
+IF(DEFINED ENV{LEMON_CXX_WARNING})
+ SET(CXX_WARNING $ENV{LEMON_CXX_WARNING})
+ELSE()
+ IF(CMAKE_COMPILER_IS_GNUCXX)
+ 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")
+ SET(CMAKE_CXX_FLAGS_DEBUG CACHE STRING "-ggdb")
+ SET(CMAKE_C_FLAGS_DEBUG CACHE STRING "-ggdb")
+ ELSEIF(MSVC)
+ # This part is unnecessary 'casue the same is set by the lemon/core.h.
+ # Still keep it as an example.
+ SET(CXX_WARNING "/wd4250 /wd4355 /wd4503 /wd4800 /wd4996")
+ # Suppressed warnings:
+ # C4250: 'class1' : inherits 'class2::member' via dominance
+ # C4355: 'this' : used in base member initializer list
+ # C4503: 'function' : decorated name length exceeded, name was truncated
+ # C4800: 'type' : forcing value to bool 'true' or 'false'
+ # (performance warning)
+ # C4996: 'function': was declared deprecated
+ ELSE()
+ SET(CXX_WARNING "-Wall -W")
+ ENDIF()
+ENDIF()
+SET(LEMON_CXX_WARNING_FLAGS ${CXX_WARNING} CACHE STRING "LEMON warning flags.")
+
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LEMON_CXX_WARNING_FLAGS}")
+
+IF(NOT CMAKE_BUILD_TYPE)
+ 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)
+ENDIF()
+
+
INCLUDE(CheckTypeSize)
CHECK_TYPE_SIZE("long long" LONG_LONG)
SET(LEMON_HAVE_LONG_LONG ${HAVE_LONG_LONG})
More information about the Lemon-commits
mailing list