gravatar
alpar (Alpar Juttner)
alpar@cs.elte.hu
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
0 1 0
default
1 file changed with 31 insertions and 0 deletions:
↑ Collapse diff ↑
Show white space 3072 line context
1 1
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
2 2

	
3 3
SET(PROJECT_NAME "LEMON")
4 4
PROJECT(${PROJECT_NAME})
5 5

	
6 6
INCLUDE(FindPythonInterp)
7 7

	
8 8
IF(EXISTS ${PROJECT_SOURCE_DIR}/cmake/version.cmake)
9 9
  INCLUDE(${PROJECT_SOURCE_DIR}/cmake/version.cmake)
10 10
ELSEIF(DEFINED ENV{LEMON_VERSION})
11 11
  SET(LEMON_VERSION $ENV{LEMON_VERSION} CACHE STRING "LEMON version string.")
12 12
ELSE()
13 13
  EXECUTE_PROCESS(
14 14
    COMMAND ${PYTHON_EXECUTABLE} ./scripts/chg-len.py
15 15
    WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
16 16
    OUTPUT_VARIABLE HG_REVISION_PATH
17 17
    ERROR_QUIET
18 18
    OUTPUT_STRIP_TRAILING_WHITESPACE
19 19
  )
20 20
  EXECUTE_PROCESS(
21 21
    COMMAND hg id -i
22 22
    WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
23 23
    OUTPUT_VARIABLE HG_REVISION
24 24
    ERROR_QUIET
25 25
    OUTPUT_STRIP_TRAILING_WHITESPACE
26 26
  )
27 27
  IF(HG_REVISION STREQUAL "")
28 28
    SET(HG_REVISION_ID "hg-tip")
29 29
  ELSE()
30 30
    IF(HG_REVISION_PATH STREQUAL "")
31 31
      SET(HG_REVISION_ID ${HG_REVISION})
32 32
    ELSE()
33 33
      SET(HG_REVISION_ID ${HG_REVISION_PATH}.${HG_REVISION})
34 34
    ENDIF()
35 35
  ENDIF()
36 36
  SET(LEMON_VERSION ${HG_REVISION_ID} CACHE STRING "LEMON version string.")
37 37
ENDIF()
38 38

	
39 39
SET(PROJECT_VERSION ${LEMON_VERSION})
40 40

	
41 41
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
42 42

	
43 43
FIND_PACKAGE(Doxygen)
44 44
FIND_PACKAGE(Ghostscript)
45 45
FIND_PACKAGE(GLPK 4.33)
46 46
FIND_PACKAGE(CPLEX)
47 47
FIND_PACKAGE(COIN)
48 48

	
49
IF(DEFINED ENV{LEMON_CXX_WARNING})
50
  SET(CXX_WARNING $ENV{LEMON_CXX_WARNING})
51
ELSE()
52
  IF(CMAKE_COMPILER_IS_GNUCXX)
53
    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")
54
    SET(CMAKE_CXX_FLAGS_DEBUG CACHE STRING "-ggdb")
55
    SET(CMAKE_C_FLAGS_DEBUG CACHE STRING "-ggdb")
56
  ELSEIF(MSVC)
57
    # This part is unnecessary 'casue the same is set by the lemon/core.h.
58
    # Still keep it as an example.
59
    SET(CXX_WARNING "/wd4250 /wd4355 /wd4503 /wd4800 /wd4996")
60
    # Suppressed warnings:
61
    # C4250: 'class1' : inherits 'class2::member' via dominance
62
    # C4355: 'this' : used in base member initializer list
63
    # C4503: 'function' : decorated name length exceeded, name was truncated
64
    # C4800: 'type' : forcing value to bool 'true' or 'false'
65
    #        (performance warning)
66
    # C4996: 'function': was declared deprecated
67
  ELSE()
68
    SET(CXX_WARNING "-Wall -W")
69
  ENDIF()
70
ENDIF()
71
SET(LEMON_CXX_WARNING_FLAGS ${CXX_WARNING} CACHE STRING "LEMON warning flags.")
72

	
73
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LEMON_CXX_WARNING_FLAGS}")
74

	
75
IF(NOT CMAKE_BUILD_TYPE)
76
  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)
77
ENDIF()
78

	
79

	
49 80
INCLUDE(CheckTypeSize)
50 81
CHECK_TYPE_SIZE("long long" LONG_LONG)
51 82
SET(LEMON_HAVE_LONG_LONG ${HAVE_LONG_LONG})
52 83

	
53 84
ENABLE_TESTING()
54 85

	
55 86
ADD_CUSTOM_TARGET(check COMMAND ${CMAKE_CTEST_COMMAND})
56 87

	
57 88
ADD_SUBDIRECTORY(lemon)
58 89
IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
59 90
  ADD_SUBDIRECTORY(demo)
60 91
  ADD_SUBDIRECTORY(tools)
61 92
  ADD_SUBDIRECTORY(doc)
62 93
  ADD_SUBDIRECTORY(test)
63 94
ENDIF()
64 95

	
65 96
CONFIGURE_FILE(
66 97
  ${PROJECT_SOURCE_DIR}/cmake/LEMONConfig.cmake.in
67 98
  ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake
68 99
  @ONLY
69 100
)
70 101
IF(UNIX)
71 102
  INSTALL(
72 103
    FILES ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake
73 104
    DESTINATION share/lemon/cmake
74 105
  )
75 106
ELSEIF(WIN32)
76 107
  INSTALL(
77 108
    FILES ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake
78 109
    DESTINATION cmake
79 110
  )
80 111
ENDIF()
81 112

	
82 113
IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR} AND WIN32)
83 114
  SET(CPACK_PACKAGE_NAME ${PROJECT_NAME})
84 115
  SET(CPACK_PACKAGE_VENDOR "EGRES")
85 116
  SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY
86 117
    "LEMON - Library for Efficient Modeling and Optimization in Networks")
87 118
  SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
88 119

	
89 120
  SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
90 121

	
91 122
  SET(CPACK_PACKAGE_INSTALL_DIRECTORY
92 123
    "${PROJECT_NAME} ${PROJECT_VERSION}")
93 124
  SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
94 125
    "${PROJECT_NAME} ${PROJECT_VERSION}")
95 126

	
96 127
  SET(CPACK_COMPONENTS_ALL headers library html_documentation bin)
97 128

	
98 129
  SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ headers")
99 130
  SET(CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "Dynamic-link library")
100 131
  SET(CPACK_COMPONENT_BIN_DISPLAY_NAME "Command line utilities")
101 132
  SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DISPLAY_NAME "HTML documentation")
102 133

	
103 134
  SET(CPACK_COMPONENT_HEADERS_DESCRIPTION
104 135
    "C++ header files")
105 136
  SET(CPACK_COMPONENT_LIBRARY_DESCRIPTION
106 137
    "DLL and import library")
107 138
  SET(CPACK_COMPONENT_BIN_DESCRIPTION
108 139
    "Command line utilities")
109 140
  SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DESCRIPTION
110 141
    "Doxygen generated documentation")
111 142

	
112 143
  SET(CPACK_COMPONENT_HEADERS_DEPENDS library)
113 144

	
114 145
  SET(CPACK_COMPONENT_HEADERS_GROUP "Development")
115 146
  SET(CPACK_COMPONENT_LIBRARY_GROUP "Development")
116 147
  SET(CPACK_COMPONENT_HTML_DOCUMENTATION_GROUP "Documentation")
117 148

	
118 149
  SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION
119 150
    "Components needed to develop software using LEMON")
120 151
  SET(CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION
121 152
    "Documentation of LEMON")
122 153

	
123 154
  SET(CPACK_ALL_INSTALL_TYPES Full Developer)
124 155

	
125 156
  SET(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full)
126 157
  SET(CPACK_COMPONENT_LIBRARY_INSTALL_TYPES Developer Full)
127 158
  SET(CPACK_COMPONENT_HTML_DOCUMENTATION_INSTALL_TYPES Full)
128 159

	
129 160
  SET(CPACK_GENERATOR "NSIS")
130 161
  SET(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis/lemon.ico")
131 162
  SET(CPACK_NSIS_MUI_UNIICON "${PROJECT_SOURCE_DIR}/cmake/nsis/uninstall.ico")
132 163
  #SET(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis\\\\installer.bmp")
133 164
  SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\lemon.ico")
134 165
  SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} ${PROJECT_NAME}")
135 166
  SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\lemon.cs.elte.hu")
136 167
  SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\lemon.cs.elte.hu")
137 168
  SET(CPACK_NSIS_CONTACT "lemon-user@lemon.cs.elte.hu")
138 169
  SET(CPACK_NSIS_CREATE_ICONS_EXTRA "
139 170
    CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Documentation.lnk\\\" \\\"$INSTDIR\\\\share\\\\doc\\\\index.html\\\"
140 171
    ")
141 172
  SET(CPACK_NSIS_DELETE_ICONS_EXTRA "
142 173
    !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
143 174
    Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\Documentation.lnk\\\"
144 175
    ")
145 176

	
146 177
  INCLUDE(CPack)
147 178
ENDIF()
0 comments (0 inline)