CMakeLists.txt
changeset 784 1a7fe3bef514
parent 680 257e91516e09
child 897 e20fecd1945f
child 964 2b6bffe0e7e8
     1.1 --- a/CMakeLists.txt	Fri Oct 16 10:21:37 2009 +0200
     1.2 +++ b/CMakeLists.txt	Thu Nov 05 15:50:01 2009 +0100
     1.3 @@ -1,37 +1,75 @@
     1.4  CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
     1.5  
     1.6 -IF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/version.cmake)
     1.7 -  INCLUDE(${CMAKE_SOURCE_DIR}/cmake/version.cmake)
     1.8 -ELSE(EXISTS ${CMAKE_SOURCE_DIR}/cmake/version.cmake)
     1.9 -  SET(PROJECT_NAME "LEMON")
    1.10 -  SET(PROJECT_VERSION "hg-tip" CACHE STRING "LEMON version string.")
    1.11 -ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/version.cmake)
    1.12 -
    1.13 +SET(PROJECT_NAME "LEMON")
    1.14  PROJECT(${PROJECT_NAME})
    1.15  
    1.16 -SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
    1.17 +IF(EXISTS ${PROJECT_SOURCE_DIR}/cmake/version.cmake)
    1.18 +  INCLUDE(${PROJECT_SOURCE_DIR}/cmake/version.cmake)
    1.19 +ELSEIF(DEFINED ENV{LEMON_VERSION})
    1.20 +  SET(LEMON_VERSION $ENV{LEMON_VERSION} CACHE STRING "LEMON version string.")
    1.21 +ELSE()
    1.22 +  EXECUTE_PROCESS(
    1.23 +    COMMAND hg id -i
    1.24 +    WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
    1.25 +    OUTPUT_VARIABLE HG_REVISION
    1.26 +    ERROR_QUIET
    1.27 +    OUTPUT_STRIP_TRAILING_WHITESPACE
    1.28 +  )
    1.29 +  IF(HG_REVISION STREQUAL "")
    1.30 +    SET(HG_REVISION "hg-tip")
    1.31 +  ENDIF()
    1.32 +  SET(LEMON_VERSION ${HG_REVISION} CACHE STRING "LEMON version string.")
    1.33 +ENDIF()
    1.34  
    1.35 -INCLUDE(FindDoxygen)
    1.36 -INCLUDE(FindGhostscript)
    1.37 +SET(PROJECT_VERSION ${LEMON_VERSION})
    1.38  
    1.39 -ADD_DEFINITIONS(-DHAVE_CONFIG_H)
    1.40 +SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
    1.41 +
    1.42 +FIND_PACKAGE(Doxygen)
    1.43 +FIND_PACKAGE(Ghostscript)
    1.44 +FIND_PACKAGE(GLPK 4.33)
    1.45 +FIND_PACKAGE(CPLEX)
    1.46 +FIND_PACKAGE(COIN)
    1.47  
    1.48  INCLUDE(CheckTypeSize)
    1.49 -CHECK_TYPE_SIZE("long long" LEMON_LONG_LONG)
    1.50 +CHECK_TYPE_SIZE("long long" LONG_LONG)
    1.51 +SET(LEMON_HAVE_LONG_LONG ${HAVE_LONG_LONG})
    1.52 +
    1.53 +INCLUDE(FindPythonInterp)
    1.54  
    1.55  ENABLE_TESTING()
    1.56  
    1.57  ADD_SUBDIRECTORY(lemon)
    1.58 -ADD_SUBDIRECTORY(demo)
    1.59 -ADD_SUBDIRECTORY(doc)
    1.60 -ADD_SUBDIRECTORY(test)
    1.61 +IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
    1.62 +  ADD_SUBDIRECTORY(demo)
    1.63 +  ADD_SUBDIRECTORY(tools)
    1.64 +  ADD_SUBDIRECTORY(doc)
    1.65 +  ADD_SUBDIRECTORY(test)
    1.66 +ENDIF()
    1.67  
    1.68 -IF(WIN32)
    1.69 +CONFIGURE_FILE(
    1.70 +  ${PROJECT_SOURCE_DIR}/cmake/LEMONConfig.cmake.in
    1.71 +  ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake
    1.72 +  @ONLY
    1.73 +)
    1.74 +IF(UNIX)
    1.75 +  INSTALL(
    1.76 +    FILES ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake
    1.77 +    DESTINATION share/lemon/cmake
    1.78 +  )
    1.79 +ELSEIF(WIN32)
    1.80 +  INSTALL(
    1.81 +    FILES ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake
    1.82 +    DESTINATION cmake
    1.83 +  )
    1.84 +ENDIF()
    1.85 +
    1.86 +IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR} AND WIN32)
    1.87    SET(CPACK_PACKAGE_NAME ${PROJECT_NAME})
    1.88    SET(CPACK_PACKAGE_VENDOR "EGRES")
    1.89    SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY
    1.90 -    "LEMON - Library of Efficient Models and Optimization in Networks")
    1.91 -  SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
    1.92 +    "LEMON - Library for Efficient Modeling and Optimization in Networks")
    1.93 +  SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
    1.94  
    1.95    SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
    1.96  
    1.97 @@ -40,16 +78,19 @@
    1.98    SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
    1.99      "${PROJECT_NAME} ${PROJECT_VERSION}")
   1.100  
   1.101 -  SET(CPACK_COMPONENTS_ALL headers library html_documentation)
   1.102 +  SET(CPACK_COMPONENTS_ALL headers library html_documentation bin)
   1.103  
   1.104    SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ headers")
   1.105    SET(CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "Dynamic-link library")
   1.106 +  SET(CPACK_COMPONENT_BIN_DISPLAY_NAME "Command line utilities")
   1.107    SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DISPLAY_NAME "HTML documentation")
   1.108  
   1.109    SET(CPACK_COMPONENT_HEADERS_DESCRIPTION
   1.110      "C++ header files")
   1.111    SET(CPACK_COMPONENT_LIBRARY_DESCRIPTION
   1.112      "DLL and import library")
   1.113 +  SET(CPACK_COMPONENT_BIN_DESCRIPTION
   1.114 +    "Command line utilities")
   1.115    SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DESCRIPTION
   1.116      "Doxygen generated documentation")
   1.117  
   1.118 @@ -71,9 +112,9 @@
   1.119    SET(CPACK_COMPONENT_HTML_DOCUMENTATION_INSTALL_TYPES Full)
   1.120  
   1.121    SET(CPACK_GENERATOR "NSIS")
   1.122 -  SET(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/cmake/nsis/lemon.ico")
   1.123 -  SET(CPACK_NSIS_MUI_UNIICON "${CMAKE_SOURCE_DIR}/cmake/nsis/uninstall.ico")
   1.124 -  #SET(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/cmake/nsis\\\\installer.bmp")
   1.125 +  SET(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis/lemon.ico")
   1.126 +  SET(CPACK_NSIS_MUI_UNIICON "${PROJECT_SOURCE_DIR}/cmake/nsis/uninstall.ico")
   1.127 +  #SET(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis\\\\installer.bmp")
   1.128    SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\lemon.ico")
   1.129    SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} ${PROJECT_NAME}")
   1.130    SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\lemon.cs.elte.hu")
   1.131 @@ -88,4 +129,4 @@
   1.132      ")
   1.133  
   1.134    INCLUDE(CPack)
   1.135 -ENDIF(WIN32)
   1.136 +ENDIF()