COIN-OR::LEMON - Graph Library

source: lemon-1.2/CMakeLists.txt @ 679:9c7639f3a741

Last change on this file since 679:9c7639f3a741 was 679:9c7639f3a741, checked in by Akos Ladanyi <ladanyi@…>, 10 years ago

Minor CMake improvements

  • Use the empty ELSE(), ENDIF(), ENDMACRO(), etc. syntax since this improves readability and requires less typing.
  • Use FIND_PACKAGE() instead of INCLUDE().
  • Use the value of CMAKE_COMMAND variable instead of cmake, since this works even if cmake is not in the PATH.
File size: 4.1 KB
Line 
1CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
2
3SET(PROJECT_NAME "LEMON")
4PROJECT(${PROJECT_NAME})
5
6IF(EXISTS ${PROJECT_SOURCE_DIR}/cmake/version.cmake)
7  INCLUDE(${PROJECT_SOURCE_DIR}/cmake/version.cmake)
8ELSEIF(DEFINED ENV{LEMON_VERSION})
9  SET(LEMON_VERSION $ENV{LEMON_VERSION} CACHE STRING "LEMON version string.")
10ELSE()
11  EXECUTE_PROCESS(
12    COMMAND hg id -i
13    WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
14    OUTPUT_VARIABLE HG_REVISION
15    ERROR_QUIET
16    OUTPUT_STRIP_TRAILING_WHITESPACE
17  )
18  SET(LEMON_VERSION ${HG_REVISION} CACHE STRING "LEMON version string.")
19ENDIF()
20
21SET(PROJECT_VERSION ${LEMON_VERSION})
22
23SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
24
25FIND_PACKAGE(Doxygen)
26FIND_PACKAGE(Ghostscript)
27FIND_PACKAGE(GLPK 4.33)
28FIND_PACKAGE(CPLEX)
29FIND_PACKAGE(COIN)
30
31INCLUDE(CheckTypeSize)
32CHECK_TYPE_SIZE("long long" LONG_LONG)
33SET(LEMON_HAVE_LONG_LONG ${HAVE_LONG_LONG})
34
35ENABLE_TESTING()
36
37ADD_SUBDIRECTORY(lemon)
38IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
39  ADD_SUBDIRECTORY(demo)
40  ADD_SUBDIRECTORY(tools)
41  ADD_SUBDIRECTORY(doc)
42  ADD_SUBDIRECTORY(test)
43ENDIF()
44
45CONFIGURE_FILE(
46  ${PROJECT_SOURCE_DIR}/cmake/LEMONConfig.cmake.in
47  ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake
48  @ONLY
49)
50IF(UNIX)
51  INSTALL(
52    FILES ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake
53    DESTINATION share/lemon/cmake
54  )
55ELSEIF(WIN32)
56  INSTALL(
57    FILES ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake
58    DESTINATION cmake
59  )
60ENDIF()
61
62IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR} AND WIN32)
63  SET(CPACK_PACKAGE_NAME ${PROJECT_NAME})
64  SET(CPACK_PACKAGE_VENDOR "EGRES")
65  SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY
66    "LEMON - Library for Efficient Modeling and Optimization in Networks")
67  SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
68
69  SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
70
71  SET(CPACK_PACKAGE_INSTALL_DIRECTORY
72    "${PROJECT_NAME} ${PROJECT_VERSION}")
73  SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
74    "${PROJECT_NAME} ${PROJECT_VERSION}")
75
76  SET(CPACK_COMPONENTS_ALL headers library html_documentation bin)
77
78  SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ headers")
79  SET(CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "Dynamic-link library")
80  SET(CPACK_COMPONENT_BIN_DISPLAY_NAME "Command line utilities")
81  SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DISPLAY_NAME "HTML documentation")
82
83  SET(CPACK_COMPONENT_HEADERS_DESCRIPTION
84    "C++ header files")
85  SET(CPACK_COMPONENT_LIBRARY_DESCRIPTION
86    "DLL and import library")
87  SET(CPACK_COMPONENT_BIN_DESCRIPTION
88    "Command line utilities")
89  SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DESCRIPTION
90    "Doxygen generated documentation")
91
92  SET(CPACK_COMPONENT_HEADERS_DEPENDS library)
93
94  SET(CPACK_COMPONENT_HEADERS_GROUP "Development")
95  SET(CPACK_COMPONENT_LIBRARY_GROUP "Development")
96  SET(CPACK_COMPONENT_HTML_DOCUMENTATION_GROUP "Documentation")
97
98  SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION
99    "Components needed to develop software using LEMON")
100  SET(CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION
101    "Documentation of LEMON")
102
103  SET(CPACK_ALL_INSTALL_TYPES Full Developer)
104
105  SET(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full)
106  SET(CPACK_COMPONENT_LIBRARY_INSTALL_TYPES Developer Full)
107  SET(CPACK_COMPONENT_HTML_DOCUMENTATION_INSTALL_TYPES Full)
108
109  SET(CPACK_GENERATOR "NSIS")
110  SET(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis/lemon.ico")
111  SET(CPACK_NSIS_MUI_UNIICON "${PROJECT_SOURCE_DIR}/cmake/nsis/uninstall.ico")
112  #SET(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis\\\\installer.bmp")
113  SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\lemon.ico")
114  SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} ${PROJECT_NAME}")
115  SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\lemon.cs.elte.hu")
116  SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\lemon.cs.elte.hu")
117  SET(CPACK_NSIS_CONTACT "lemon-user@lemon.cs.elte.hu")
118  SET(CPACK_NSIS_CREATE_ICONS_EXTRA "
119    CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Documentation.lnk\\\" \\\"$INSTDIR\\\\share\\\\doc\\\\index.html\\\"
120    ")
121  SET(CPACK_NSIS_DELETE_ICONS_EXTRA "
122    !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
123    Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\Documentation.lnk\\\"
124    ")
125
126  INCLUDE(CPack)
127ENDIF()
Note: See TracBrowser for help on using the repository browser.