diff --git a/CMakeLists.txt b/CMakeLists.txt index b9613a7..e43ffee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,3 +22,23 @@ include_directories(include) add_subdirectory("include") add_subdirectory("libmetis") # add_subdirectory("programs") + +if(METIS_INSTALL) + set(PRJ_NAME metis) + set(PRJ_VER 5.1.0) + install(EXPORT metisTargets + FILE ${PRJ_NAME}Targets.cmake + DESTINATION lib/cmake/${PRJ_NAME}) + include(CMakePackageConfigHelpers) + write_basic_package_version_file( + ${CMAKE_CURRENT_BINARY_DIR}/${PRJ_NAME}ConfigVersion.cmake + VERSION ${PRJ_VER} + COMPATIBILITY SameMajorVersion) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${PRJ_NAME}Config.cmake + "include(\${CMAKE_CURRENT_LIST_DIR}/${PRJ_NAME}Targets.cmake)") + install(FILES + ${CMAKE_CURRENT_BINARY_DIR}/${PRJ_NAME}ConfigVersion.cmake + ${CMAKE_CURRENT_BINARY_DIR}/${PRJ_NAME}Config.cmake + DESTINATION lib/cmake/${PRJ_NAME}) +endif() + diff --git a/libmetis/CMakeLists.txt b/libmetis/CMakeLists.txt index 7a5fc74..5a68cf0 100644 --- a/libmetis/CMakeLists.txt +++ b/libmetis/CMakeLists.txt @@ -9,8 +9,9 @@ if(UNIX) endif() if(METIS_INSTALL) - install(TARGETS metis + install(TARGETS metis EXPORT metisTargets LIBRARY DESTINATION lib RUNTIME DESTINATION bin - ARCHIVE DESTINATION lib) + ARCHIVE DESTINATION lib + INCLUDES DESTINATION include) endif()