diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,8 +22,8 @@ SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) -INCLUDE(FindDoxygen) -INCLUDE(FindGhostscript) +FIND_PACKAGE(Doxygen) +FIND_PACKAGE(Ghostscript) FIND_PACKAGE(GLPK 4.33) FIND_PACKAGE(CPLEX) FIND_PACKAGE(COIN) @@ -40,7 +40,7 @@ ADD_SUBDIRECTORY(tools) ADD_SUBDIRECTORY(doc) ADD_SUBDIRECTORY(test) -ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR}) +ENDIF() CONFIGURE_FILE( ${PROJECT_SOURCE_DIR}/cmake/LEMONConfig.cmake.in @@ -57,73 +57,71 @@ FILES ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake DESTINATION cmake ) -ENDIF(UNIX) +ENDIF() -IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR}) - IF(WIN32) - SET(CPACK_PACKAGE_NAME ${PROJECT_NAME}) - SET(CPACK_PACKAGE_VENDOR "EGRES") - SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY - "LEMON - Library for Efficient Modeling and Optimization in Networks") - SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE") +IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR} AND WIN32) + SET(CPACK_PACKAGE_NAME ${PROJECT_NAME}) + SET(CPACK_PACKAGE_VENDOR "EGRES") + SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY + "LEMON - Library for Efficient Modeling and Optimization in Networks") + SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE") - SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) + SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) - SET(CPACK_PACKAGE_INSTALL_DIRECTORY - "${PROJECT_NAME} ${PROJECT_VERSION}") - SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY - "${PROJECT_NAME} ${PROJECT_VERSION}") + SET(CPACK_PACKAGE_INSTALL_DIRECTORY + "${PROJECT_NAME} ${PROJECT_VERSION}") + SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY + "${PROJECT_NAME} ${PROJECT_VERSION}") - SET(CPACK_COMPONENTS_ALL headers library html_documentation bin) + SET(CPACK_COMPONENTS_ALL headers library html_documentation bin) - SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ headers") - SET(CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "Dynamic-link library") - SET(CPACK_COMPONENT_BIN_DISPLAY_NAME "Command line utilities") - SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DISPLAY_NAME "HTML documentation") + SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ headers") + SET(CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "Dynamic-link library") + SET(CPACK_COMPONENT_BIN_DISPLAY_NAME "Command line utilities") + SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DISPLAY_NAME "HTML documentation") - SET(CPACK_COMPONENT_HEADERS_DESCRIPTION - "C++ header files") - SET(CPACK_COMPONENT_LIBRARY_DESCRIPTION - "DLL and import library") - SET(CPACK_COMPONENT_BIN_DESCRIPTION - "Command line utilities") - SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DESCRIPTION - "Doxygen generated documentation") + SET(CPACK_COMPONENT_HEADERS_DESCRIPTION + "C++ header files") + SET(CPACK_COMPONENT_LIBRARY_DESCRIPTION + "DLL and import library") + SET(CPACK_COMPONENT_BIN_DESCRIPTION + "Command line utilities") + SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DESCRIPTION + "Doxygen generated documentation") - SET(CPACK_COMPONENT_HEADERS_DEPENDS library) + SET(CPACK_COMPONENT_HEADERS_DEPENDS library) - SET(CPACK_COMPONENT_HEADERS_GROUP "Development") - SET(CPACK_COMPONENT_LIBRARY_GROUP "Development") - SET(CPACK_COMPONENT_HTML_DOCUMENTATION_GROUP "Documentation") + SET(CPACK_COMPONENT_HEADERS_GROUP "Development") + SET(CPACK_COMPONENT_LIBRARY_GROUP "Development") + SET(CPACK_COMPONENT_HTML_DOCUMENTATION_GROUP "Documentation") - SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION - "Components needed to develop software using LEMON") - SET(CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION - "Documentation of LEMON") + SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION + "Components needed to develop software using LEMON") + SET(CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION + "Documentation of LEMON") - SET(CPACK_ALL_INSTALL_TYPES Full Developer) + SET(CPACK_ALL_INSTALL_TYPES Full Developer) - SET(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full) - SET(CPACK_COMPONENT_LIBRARY_INSTALL_TYPES Developer Full) - SET(CPACK_COMPONENT_HTML_DOCUMENTATION_INSTALL_TYPES Full) + SET(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full) + SET(CPACK_COMPONENT_LIBRARY_INSTALL_TYPES Developer Full) + SET(CPACK_COMPONENT_HTML_DOCUMENTATION_INSTALL_TYPES Full) - SET(CPACK_GENERATOR "NSIS") - SET(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis/lemon.ico") - SET(CPACK_NSIS_MUI_UNIICON "${PROJECT_SOURCE_DIR}/cmake/nsis/uninstall.ico") - #SET(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis\\\\installer.bmp") - SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\lemon.ico") - SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} ${PROJECT_NAME}") - SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\lemon.cs.elte.hu") - SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\lemon.cs.elte.hu") - SET(CPACK_NSIS_CONTACT "lemon-user@lemon.cs.elte.hu") - SET(CPACK_NSIS_CREATE_ICONS_EXTRA " - CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Documentation.lnk\\\" \\\"$INSTDIR\\\\share\\\\doc\\\\index.html\\\" - ") - SET(CPACK_NSIS_DELETE_ICONS_EXTRA " - !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP - Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\Documentation.lnk\\\" - ") + SET(CPACK_GENERATOR "NSIS") + SET(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis/lemon.ico") + SET(CPACK_NSIS_MUI_UNIICON "${PROJECT_SOURCE_DIR}/cmake/nsis/uninstall.ico") + #SET(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis\\\\installer.bmp") + SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\lemon.ico") + SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} ${PROJECT_NAME}") + SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\lemon.cs.elte.hu") + SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\lemon.cs.elte.hu") + SET(CPACK_NSIS_CONTACT "lemon-user@lemon.cs.elte.hu") + SET(CPACK_NSIS_CREATE_ICONS_EXTRA " + CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Documentation.lnk\\\" \\\"$INSTDIR\\\\share\\\\doc\\\\index.html\\\" + ") + SET(CPACK_NSIS_DELETE_ICONS_EXTRA " + !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP + Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\Documentation.lnk\\\" + ") - INCLUDE(CPack) - ENDIF(WIN32) -ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR}) + INCLUDE(CPack) +ENDIF() diff --git a/demo/CMakeLists.txt b/demo/CMakeLists.txt --- a/demo/CMakeLists.txt +++ b/demo/CMakeLists.txt @@ -3,14 +3,17 @@ ${PROJECT_BINARY_DIR} ) -LINK_DIRECTORIES(${PROJECT_BINARY_DIR}/lemon) +LINK_DIRECTORIES( + ${PROJECT_BINARY_DIR}/lemon +) SET(DEMOS arg_parser_demo graph_to_eps_demo - lgf_demo) + lgf_demo +) FOREACH(DEMO_NAME ${DEMOS}) ADD_EXECUTABLE(${DEMO_NAME} ${DEMO_NAME}.cc) TARGET_LINK_LIBRARIES(${DEMO_NAME} lemon) -ENDFOREACH(DEMO_NAME) +ENDFOREACH() diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -46,6 +46,6 @@ DESTINATION doc COMPONENT html_documentation ) - ENDIF(UNIX) + ENDIF() -ENDIF(DOXYGEN_EXECUTABLE AND GHOSTSCRIPT_EXECUTABLE) +ENDIF() diff --git a/lemon/CMakeLists.txt b/lemon/CMakeLists.txt --- a/lemon/CMakeLists.txt +++ b/lemon/CMakeLists.txt @@ -25,28 +25,28 @@ INSTALL(FILES ${GLPK_BIN_DIR}/glpk.dll DESTINATION bin) INSTALL(FILES ${GLPK_BIN_DIR}/libltdl3.dll DESTINATION bin) INSTALL(FILES ${GLPK_BIN_DIR}/zlib1.dll DESTINATION bin) - ENDIF(WIN32) -ENDIF(LEMON_HAVE_GLPK) + ENDIF() +ENDIF() IF(LEMON_HAVE_CPLEX) SET(LEMON_SOURCES ${LEMON_SOURCES} cplex.cc) INCLUDE_DIRECTORIES(${CPLEX_INCLUDE_DIRS}) -ENDIF(LEMON_HAVE_CPLEX) +ENDIF() IF(LEMON_HAVE_CLP) SET(LEMON_SOURCES ${LEMON_SOURCES} clp.cc) INCLUDE_DIRECTORIES(${COIN_INCLUDE_DIRS}) -ENDIF(LEMON_HAVE_CLP) +ENDIF() IF(LEMON_HAVE_CBC) SET(LEMON_SOURCES ${LEMON_SOURCES} cbc.cc) INCLUDE_DIRECTORIES(${COIN_INCLUDE_DIRS}) -ENDIF(LEMON_HAVE_CBC) +ENDIF() ADD_LIBRARY(lemon ${LEMON_SOURCES}) IF(UNIX) SET_TARGET_PROPERTIES(lemon PROPERTIES OUTPUT_NAME emon) -ENDIF(UNIX) +ENDIF() INSTALL( TARGETS lemon diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -3,7 +3,9 @@ ${PROJECT_BINARY_DIR} ) -LINK_DIRECTORIES(${PROJECT_BINARY_DIR}/lemon) +LINK_DIRECTORIES( + ${PROJECT_BINARY_DIR}/lemon +) SET(TESTS adaptors_test @@ -35,20 +37,23 @@ random_test suurballe_test time_measure_test - unionfind_test) + unionfind_test +) IF(LEMON_HAVE_LP) ADD_EXECUTABLE(lp_test lp_test.cc) SET(LP_TEST_LIBS lemon) + IF(LEMON_HAVE_GLPK) SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES}) - ENDIF(LEMON_HAVE_GLPK) + ENDIF() IF(LEMON_HAVE_CPLEX) SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES}) - ENDIF(LEMON_HAVE_CPLEX) + ENDIF() IF(LEMON_HAVE_CLP) SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES}) - ENDIF(LEMON_HAVE_CLP) + ENDIF() + TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS}) ADD_TEST(lp_test lp_test) @@ -56,32 +61,35 @@ GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION) GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH) ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD - COMMAND cmake -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH} - COMMAND cmake -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH} - COMMAND cmake -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH} ) - ENDIF(WIN32 AND LEMON_HAVE_GLPK) + ENDIF() + IF(WIN32 AND LEMON_HAVE_CPLEX) GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION) GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH) ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD - COMMAND cmake -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH} ) - ENDIF(WIN32 AND LEMON_HAVE_CPLEX) -ENDIF(LEMON_HAVE_LP) + ENDIF() +ENDIF() IF(LEMON_HAVE_MIP) ADD_EXECUTABLE(mip_test mip_test.cc) SET(MIP_TEST_LIBS lemon) + IF(LEMON_HAVE_GLPK) SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES}) - ENDIF(LEMON_HAVE_GLPK) + ENDIF() IF(LEMON_HAVE_CPLEX) SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES}) - ENDIF(LEMON_HAVE_CPLEX) + ENDIF() IF(LEMON_HAVE_CBC) SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES}) - ENDIF(LEMON_HAVE_CBC) + ENDIF() + TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS}) ADD_TEST(mip_test mip_test) @@ -89,22 +97,23 @@ GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION) GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH) ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD - COMMAND cmake -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH} - COMMAND cmake -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH} - COMMAND cmake -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH} ) - ENDIF(WIN32 AND LEMON_HAVE_GLPK) + ENDIF() + IF(WIN32 AND LEMON_HAVE_CPLEX) GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION) GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH) ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD - COMMAND cmake -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH} ) - ENDIF(WIN32 AND LEMON_HAVE_CPLEX) -ENDIF(LEMON_HAVE_MIP) + ENDIF() +ENDIF() FOREACH(TEST_NAME ${TESTS}) ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc) TARGET_LINK_LIBRARIES(${TEST_NAME} lemon) ADD_TEST(${TEST_NAME} ${TEST_NAME}) -ENDFOREACH(TEST_NAME) +ENDFOREACH() diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -3,7 +3,9 @@ ${PROJECT_BINARY_DIR} ) -LINK_DIRECTORIES(${PROJECT_BINARY_DIR}/lemon) +LINK_DIRECTORIES( + ${PROJECT_BINARY_DIR}/lemon +) ADD_EXECUTABLE(lgf-gen lgf-gen.cc) TARGET_LINK_LIBRARIES(lgf-gen lemon) @@ -24,5 +26,6 @@ INSTALL( PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/lemon-0.x-to-1.x.sh DESTINATION bin - COMPONENT bin) -ENDIF(NOT WIN32) + COMPONENT bin + ) +ENDIF()