CMakeLists.txt
author Alpar Juttner <alpar@cs.elte.hu>
Wed, 18 Mar 2009 16:18:05 +0000
changeset 597 20e3acc1a757
parent 574 c458e02723b1
child 599 56a86a363c12
permissions -rw-r--r--
Switch on warnings when compiling the lib
     1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
     2 
     3 IF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/version.cmake)
     4   INCLUDE(${CMAKE_SOURCE_DIR}/cmake/version.cmake)
     5 ELSE(EXISTS ${CMAKE_SOURCE_DIR}/cmake/version.cmake)
     6   SET(PROJECT_NAME "LEMON")
     7   SET(PROJECT_VERSION "hg-tip" CACHE STRING "LEMON version string.")
     8 ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/version.cmake)
     9 
    10 PROJECT(${PROJECT_NAME})
    11 
    12 SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
    13 
    14 INCLUDE(FindDoxygen)
    15 INCLUDE(FindGhostscript)
    16 FIND_PACKAGE(GLPK 4.33)
    17 
    18 ADD_DEFINITIONS(-DHAVE_CONFIG_H)
    19 
    20 IF(MSVC)
    21   SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4250 /wd4355 /wd4800 /wd4996")
    22 # Suppressed warnings:
    23 # C4250: 'class1' : inherits 'class2::member' via dominance
    24 # C4355: 'this' : used in base member initializer list
    25 # C4800: 'type' : forcing value to bool 'true' or 'false' (performance warning)
    26 # C4996: 'function': was declared deprecated
    27 ENDIF(MSVC)
    28 
    29 IF(GLPK_FOUND)
    30   SET(HAVE_LP TRUE)
    31   SET(HAVE_MIP TRUE)
    32   SET(HAVE_GLPK TRUE)
    33 ENDIF(GLPK_FOUND)
    34 
    35 INCLUDE(CheckTypeSize)
    36 CHECK_TYPE_SIZE("long long" LONG_LONG)
    37 
    38 ENABLE_TESTING()
    39 
    40 ADD_SUBDIRECTORY(lemon)
    41 IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
    42   ADD_SUBDIRECTORY(demo)
    43   ADD_SUBDIRECTORY(tools)
    44   ADD_SUBDIRECTORY(doc)
    45   ADD_SUBDIRECTORY(test)
    46 ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
    47 
    48 IF(WIN32)
    49   SET(CPACK_PACKAGE_NAME ${PROJECT_NAME})
    50   SET(CPACK_PACKAGE_VENDOR "EGRES")
    51   SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY
    52     "LEMON - Library of Efficient Models and Optimization in Networks")
    53   SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
    54 
    55   SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
    56 
    57   SET(CPACK_PACKAGE_INSTALL_DIRECTORY
    58     "${PROJECT_NAME} ${PROJECT_VERSION}")
    59   SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
    60     "${PROJECT_NAME} ${PROJECT_VERSION}")
    61 
    62   SET(CPACK_COMPONENTS_ALL headers library html_documentation bin)
    63 
    64   SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ headers")
    65   SET(CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "Dynamic-link library")
    66   SET(CPACK_COMPONENT_BIN_DISPLAY_NAME "Command line utilities")
    67   SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DISPLAY_NAME "HTML documentation")
    68 
    69   SET(CPACK_COMPONENT_HEADERS_DESCRIPTION
    70     "C++ header files")
    71   SET(CPACK_COMPONENT_LIBRARY_DESCRIPTION
    72     "DLL and import library")
    73   SET(CPACK_COMPONENT_BIN_DESCRIPTION
    74     "Command line utilities")
    75   SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DESCRIPTION
    76     "Doxygen generated documentation")
    77 
    78   SET(CPACK_COMPONENT_HEADERS_DEPENDS library)
    79 
    80   SET(CPACK_COMPONENT_HEADERS_GROUP "Development")
    81   SET(CPACK_COMPONENT_LIBRARY_GROUP "Development")
    82   SET(CPACK_COMPONENT_HTML_DOCUMENTATION_GROUP "Documentation")
    83 
    84   SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION
    85     "Components needed to develop software using LEMON")
    86   SET(CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION
    87     "Documentation of LEMON")
    88 
    89   SET(CPACK_ALL_INSTALL_TYPES Full Developer)
    90 
    91   SET(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full)
    92   SET(CPACK_COMPONENT_LIBRARY_INSTALL_TYPES Developer Full)
    93   SET(CPACK_COMPONENT_HTML_DOCUMENTATION_INSTALL_TYPES Full)
    94 
    95   SET(CPACK_GENERATOR "NSIS")
    96   SET(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/cmake/nsis/lemon.ico")
    97   SET(CPACK_NSIS_MUI_UNIICON "${CMAKE_SOURCE_DIR}/cmake/nsis/uninstall.ico")
    98   #SET(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/cmake/nsis\\\\installer.bmp")
    99   SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\lemon.ico")
   100   SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} ${PROJECT_NAME}")
   101   SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\lemon.cs.elte.hu")
   102   SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\lemon.cs.elte.hu")
   103   SET(CPACK_NSIS_CONTACT "lemon-user@lemon.cs.elte.hu")
   104   SET(CPACK_NSIS_CREATE_ICONS_EXTRA "
   105     CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Documentation.lnk\\\" \\\"$INSTDIR\\\\share\\\\doc\\\\index.html\\\"
   106     ")
   107   SET(CPACK_NSIS_DELETE_ICONS_EXTRA "
   108     !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
   109     Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\Documentation.lnk\\\"
   110     ")
   111 
   112   INCLUDE(CPack)
   113 ENDIF(WIN32)