CMakeLists.txt
author Akos Ladanyi <ladanyi@tmit.bme.hu>
Fri, 29 May 2009 11:40:53 +0100
changeset 725 d1e1cd94bf49
parent 724 a0265f621d39
child 726 9c7639f3a741
permissions -rw-r--r--
Put the version string into config.h

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