COIN-OR::LEMON - Graph Library

Changeset 679:9c7639f3a741 in lemon-main


Ignore:
Timestamp:
05/29/09 13:44:37 (16 years ago)
Author:
Akos Ladanyi <ladanyi@…>
Branch:
default
Phase:
public
Message:

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.
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • CMakeLists.txt

    r678 r679  
    2323SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
    2424
    25 INCLUDE(FindDoxygen)
    26 INCLUDE(FindGhostscript)
     25FIND_PACKAGE(Doxygen)
     26FIND_PACKAGE(Ghostscript)
    2727FIND_PACKAGE(GLPK 4.33)
    2828FIND_PACKAGE(CPLEX)
     
    4141  ADD_SUBDIRECTORY(doc)
    4242  ADD_SUBDIRECTORY(test)
    43 ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
     43ENDIF()
    4444
    4545CONFIGURE_FILE(
     
    5858    DESTINATION cmake
    5959  )
    60 ENDIF(UNIX)
     60ENDIF()
    6161
    62 IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
    63   IF(WIN32)
    64     SET(CPACK_PACKAGE_NAME ${PROJECT_NAME})
    65     SET(CPACK_PACKAGE_VENDOR "EGRES")
    66     SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY
    67       "LEMON - Library for Efficient Modeling and Optimization in Networks")
    68     SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
     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")
    6968
    70     SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
     69  SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
    7170
    72     SET(CPACK_PACKAGE_INSTALL_DIRECTORY
    73       "${PROJECT_NAME} ${PROJECT_VERSION}")
    74     SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
    75       "${PROJECT_NAME} ${PROJECT_VERSION}")
     71  SET(CPACK_PACKAGE_INSTALL_DIRECTORY
     72    "${PROJECT_NAME} ${PROJECT_VERSION}")
     73  SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
     74    "${PROJECT_NAME} ${PROJECT_VERSION}")
    7675
    77     SET(CPACK_COMPONENTS_ALL headers library html_documentation bin)
     76  SET(CPACK_COMPONENTS_ALL headers library html_documentation bin)
    7877
    79     SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ headers")
    80     SET(CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "Dynamic-link library")
    81     SET(CPACK_COMPONENT_BIN_DISPLAY_NAME "Command line utilities")
    82     SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DISPLAY_NAME "HTML documentation")
     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")
    8382
    84     SET(CPACK_COMPONENT_HEADERS_DESCRIPTION
    85       "C++ header files")
    86     SET(CPACK_COMPONENT_LIBRARY_DESCRIPTION
    87       "DLL and import library")
    88     SET(CPACK_COMPONENT_BIN_DESCRIPTION
    89       "Command line utilities")
    90     SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DESCRIPTION
    91       "Doxygen generated documentation")
     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")
    9291
    93     SET(CPACK_COMPONENT_HEADERS_DEPENDS library)
     92  SET(CPACK_COMPONENT_HEADERS_DEPENDS library)
    9493
    95     SET(CPACK_COMPONENT_HEADERS_GROUP "Development")
    96     SET(CPACK_COMPONENT_LIBRARY_GROUP "Development")
    97     SET(CPACK_COMPONENT_HTML_DOCUMENTATION_GROUP "Documentation")
     94  SET(CPACK_COMPONENT_HEADERS_GROUP "Development")
     95  SET(CPACK_COMPONENT_LIBRARY_GROUP "Development")
     96  SET(CPACK_COMPONENT_HTML_DOCUMENTATION_GROUP "Documentation")
    9897
    99     SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION
    100       "Components needed to develop software using LEMON")
    101     SET(CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION
    102       "Documentation of LEMON")
     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")
    103102
    104     SET(CPACK_ALL_INSTALL_TYPES Full Developer)
     103  SET(CPACK_ALL_INSTALL_TYPES Full Developer)
    105104
    106     SET(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full)
    107     SET(CPACK_COMPONENT_LIBRARY_INSTALL_TYPES Developer Full)
    108     SET(CPACK_COMPONENT_HTML_DOCUMENTATION_INSTALL_TYPES Full)
     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)
    109108
    110     SET(CPACK_GENERATOR "NSIS")
    111     SET(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis/lemon.ico")
    112     SET(CPACK_NSIS_MUI_UNIICON "${PROJECT_SOURCE_DIR}/cmake/nsis/uninstall.ico")
    113     #SET(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis\\\\installer.bmp")
    114     SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\lemon.ico")
    115     SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} ${PROJECT_NAME}")
    116     SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\lemon.cs.elte.hu")
    117     SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\lemon.cs.elte.hu")
    118     SET(CPACK_NSIS_CONTACT "lemon-user@lemon.cs.elte.hu")
    119     SET(CPACK_NSIS_CREATE_ICONS_EXTRA "
    120       CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Documentation.lnk\\\" \\\"$INSTDIR\\\\share\\\\doc\\\\index.html\\\"
    121       ")
    122     SET(CPACK_NSIS_DELETE_ICONS_EXTRA "
    123       !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
    124       Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\Documentation.lnk\\\"
    125       ")
     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    ")
    126125
    127     INCLUDE(CPack)
    128   ENDIF(WIN32)
    129 ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
     126  INCLUDE(CPack)
     127ENDIF()
  • demo/CMakeLists.txt

    r627 r679  
    44)
    55
    6 LINK_DIRECTORIES(${PROJECT_BINARY_DIR}/lemon)
     6LINK_DIRECTORIES(
     7  ${PROJECT_BINARY_DIR}/lemon
     8)
    79
    810SET(DEMOS
    911  arg_parser_demo
    1012  graph_to_eps_demo
    11   lgf_demo)
     13  lgf_demo
     14)
    1215
    1316FOREACH(DEMO_NAME ${DEMOS})
    1417  ADD_EXECUTABLE(${DEMO_NAME} ${DEMO_NAME}.cc)
    1518  TARGET_LINK_LIBRARIES(${DEMO_NAME} lemon)
    16 ENDFOREACH(DEMO_NAME)
     19ENDFOREACH()
  • doc/CMakeLists.txt

    r676 r679  
    4747      COMPONENT html_documentation
    4848    )
    49   ENDIF(UNIX)
     49  ENDIF()
    5050
    51 ENDIF(DOXYGEN_EXECUTABLE AND GHOSTSCRIPT_EXECUTABLE)
     51ENDIF()
  • lemon/CMakeLists.txt

    r675 r679  
    2626    INSTALL(FILES ${GLPK_BIN_DIR}/libltdl3.dll DESTINATION bin)
    2727    INSTALL(FILES ${GLPK_BIN_DIR}/zlib1.dll DESTINATION bin)
    28   ENDIF(WIN32)
    29 ENDIF(LEMON_HAVE_GLPK)
     28  ENDIF()
     29ENDIF()
    3030
    3131IF(LEMON_HAVE_CPLEX)
    3232  SET(LEMON_SOURCES ${LEMON_SOURCES} cplex.cc)
    3333  INCLUDE_DIRECTORIES(${CPLEX_INCLUDE_DIRS})
    34 ENDIF(LEMON_HAVE_CPLEX)
     34ENDIF()
    3535
    3636IF(LEMON_HAVE_CLP)
    3737  SET(LEMON_SOURCES ${LEMON_SOURCES} clp.cc)
    3838  INCLUDE_DIRECTORIES(${COIN_INCLUDE_DIRS})
    39 ENDIF(LEMON_HAVE_CLP)
     39ENDIF()
    4040
    4141IF(LEMON_HAVE_CBC)
    4242  SET(LEMON_SOURCES ${LEMON_SOURCES} cbc.cc)
    4343  INCLUDE_DIRECTORIES(${COIN_INCLUDE_DIRS})
    44 ENDIF(LEMON_HAVE_CBC)
     44ENDIF()
    4545
    4646ADD_LIBRARY(lemon ${LEMON_SOURCES})
    4747IF(UNIX)
    4848  SET_TARGET_PROPERTIES(lemon PROPERTIES OUTPUT_NAME emon)
    49 ENDIF(UNIX)
     49ENDIF()
    5050
    5151INSTALL(
  • test/CMakeLists.txt

    r649 r679  
    44)
    55
    6 LINK_DIRECTORIES(${PROJECT_BINARY_DIR}/lemon)
     6LINK_DIRECTORIES(
     7  ${PROJECT_BINARY_DIR}/lemon
     8)
    79
    810SET(TESTS
     
    3638  suurballe_test
    3739  time_measure_test
    38   unionfind_test)
     40  unionfind_test
     41)
    3942
    4043IF(LEMON_HAVE_LP)
    4144  ADD_EXECUTABLE(lp_test lp_test.cc)
    4245  SET(LP_TEST_LIBS lemon)
     46
    4347  IF(LEMON_HAVE_GLPK)
    4448    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
    45   ENDIF(LEMON_HAVE_GLPK)
     49  ENDIF()
    4650  IF(LEMON_HAVE_CPLEX)
    4751    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
    48   ENDIF(LEMON_HAVE_CPLEX)
     52  ENDIF()
    4953  IF(LEMON_HAVE_CLP)
    5054    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
    51   ENDIF(LEMON_HAVE_CLP)
     55  ENDIF()
     56
    5257  TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
    5358  ADD_TEST(lp_test lp_test)
     
    5762    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
    5863    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
    59       COMMAND cmake -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
    60       COMMAND cmake -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
    61       COMMAND cmake -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
     64      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
     65      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
     66      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
    6267    )
    63   ENDIF(WIN32 AND LEMON_HAVE_GLPK)
     68  ENDIF()
     69
    6470  IF(WIN32 AND LEMON_HAVE_CPLEX)
    6571    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
    6672    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
    6773    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
    68       COMMAND cmake -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
     74      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
    6975    )
    70   ENDIF(WIN32 AND LEMON_HAVE_CPLEX)
    71 ENDIF(LEMON_HAVE_LP)
     76  ENDIF()
     77ENDIF()
    7278
    7379IF(LEMON_HAVE_MIP)
    7480  ADD_EXECUTABLE(mip_test mip_test.cc)
    7581  SET(MIP_TEST_LIBS lemon)
     82
    7683  IF(LEMON_HAVE_GLPK)
    7784    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
    78   ENDIF(LEMON_HAVE_GLPK)
     85  ENDIF()
    7986  IF(LEMON_HAVE_CPLEX)
    8087    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
    81   ENDIF(LEMON_HAVE_CPLEX)
     88  ENDIF()
    8289  IF(LEMON_HAVE_CBC)
    8390    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
    84   ENDIF(LEMON_HAVE_CBC)
     91  ENDIF()
     92
    8593  TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
    8694  ADD_TEST(mip_test mip_test)
     
    9098    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
    9199    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
    92       COMMAND cmake -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
    93       COMMAND cmake -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
    94       COMMAND cmake -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
     100      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
     101      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
     102      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
    95103    )
    96   ENDIF(WIN32 AND LEMON_HAVE_GLPK)
     104  ENDIF()
     105
    97106  IF(WIN32 AND LEMON_HAVE_CPLEX)
    98107    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
    99108    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
    100109    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
    101       COMMAND cmake -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
     110      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
    102111    )
    103   ENDIF(WIN32 AND LEMON_HAVE_CPLEX)
    104 ENDIF(LEMON_HAVE_MIP)
     112  ENDIF()
     113ENDIF()
    105114
    106115FOREACH(TEST_NAME ${TESTS})
     
    108117  TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
    109118  ADD_TEST(${TEST_NAME} ${TEST_NAME})
    110 ENDFOREACH(TEST_NAME)
     119ENDFOREACH()
  • tools/CMakeLists.txt

    r549 r679  
    44)
    55
    6 LINK_DIRECTORIES(${PROJECT_BINARY_DIR}/lemon)
     6LINK_DIRECTORIES(
     7  ${PROJECT_BINARY_DIR}/lemon
     8)
    79
    810ADD_EXECUTABLE(lgf-gen lgf-gen.cc)
     
    2527    PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/lemon-0.x-to-1.x.sh
    2628    DESTINATION bin
    27     COMPONENT bin)
    28 ENDIF(NOT WIN32)
     29    COMPONENT bin
     30  )
     31ENDIF()
Note: See TracChangeset for help on using the changeset viewer.