diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,23 @@ ADD_SUBDIRECTORY(test) ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR}) +CONFIGURE_FILE( + ${PROJECT_SOURCE_DIR}/cmake/LEMONConfig.cmake.in + ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake + @ONLY +) +IF(UNIX) + INSTALL( + FILES ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake + DESTINATION share/lemon/cmake + ) +ELSEIF(WIN32) + INSTALL( + FILES ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake + DESTINATION cmake + ) +ENDIF(UNIX) + IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR}) IF(WIN32) SET(CPACK_PACKAGE_NAME ${PROJECT_NAME}) diff --git a/cmake/LEMONConfig.cmake.in b/cmake/LEMONConfig.cmake.in new file mode 100644 --- /dev/null +++ b/cmake/LEMONConfig.cmake.in @@ -0,0 +1,13 @@ +SET(LEMON_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include" CACHE PATH "LEMON include directory") +SET(LEMON_INCLUDE_DIRS "${LEMON_INCLUDE_DIR}") + +IF(UNIX) + SET(LEMON_LIB_NAME "libemon.a") +ELSEIF(WIN32) + SET(LEMON_LIB_NAME "lemon.lib") +ENDIF(UNIX) + +SET(LEMON_LIBRARY "@CMAKE_INSTALL_PREFIX@/lib/${LEMON_LIB_NAME}" CACHE FILEPATH "LEMON library") +SET(LEMON_LIBRARIES "${LEMON_LIBRARY}") + +MARK_AS_ADVANCED(LEMON_LIBRARY LEMON_INCLUDE_DIR) diff --git a/lemon/CMakeLists.txt b/lemon/CMakeLists.txt --- a/lemon/CMakeLists.txt +++ b/lemon/CMakeLists.txt @@ -44,19 +44,25 @@ ENDIF(LEMON_HAVE_CBC) ADD_LIBRARY(lemon ${LEMON_SOURCES}) +IF(UNIX) + SET_TARGET_PROPERTIES(lemon PROPERTIES OUTPUT_NAME emon) +ENDIF(UNIX) INSTALL( TARGETS lemon ARCHIVE DESTINATION lib - COMPONENT library) + COMPONENT library +) INSTALL( DIRECTORY . bits concepts DESTINATION include/lemon COMPONENT headers - FILES_MATCHING PATTERN "*.h") + FILES_MATCHING PATTERN "*.h" +) INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/config.h DESTINATION include/lemon - COMPONENT headers) + COMPONENT headers +)