install-rules.cmake (1770B)
1 if(PROJECT_IS_TOP_LEVEL) 2 set( 3 CMAKE_INSTALL_INCLUDEDIR "include/poafloc-${PROJECT_VERSION}" 4 CACHE STRING "" 5 ) 6 set_property(CACHE CMAKE_INSTALL_INCLUDEDIR PROPERTY TYPE PATH) 7 endif() 8 9 include(CMakePackageConfigHelpers) 10 include(GNUInstallDirs) 11 12 # find_package(<package>) call for consumers to find this project 13 set(package poafloc) 14 15 install( 16 DIRECTORY 17 include/ 18 "${PROJECT_BINARY_DIR}/export/" 19 DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" 20 COMPONENT poafloc_Development 21 ) 22 23 install( 24 TARGETS poafloc_poafloc 25 EXPORT poaflocTargets 26 RUNTIME # 27 COMPONENT poafloc_Runtime 28 LIBRARY # 29 COMPONENT poafloc_Runtime 30 NAMELINK_COMPONENT poafloc_Development 31 ARCHIVE # 32 COMPONENT poafloc_Development 33 INCLUDES # 34 DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" 35 ) 36 37 write_basic_package_version_file( 38 "${package}ConfigVersion.cmake" 39 COMPATIBILITY SameMajorVersion 40 ) 41 42 # Allow package maintainers to freely override the path for the configs 43 set( 44 poafloc_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/${package}" 45 CACHE STRING "CMake package config location relative to the install prefix" 46 ) 47 set_property(CACHE poafloc_INSTALL_CMAKEDIR PROPERTY TYPE PATH) 48 mark_as_advanced(poafloc_INSTALL_CMAKEDIR) 49 50 install( 51 FILES cmake/install-config.cmake 52 DESTINATION "${poafloc_INSTALL_CMAKEDIR}" 53 RENAME "${package}Config.cmake" 54 COMPONENT poafloc_Development 55 ) 56 57 install( 58 FILES "${PROJECT_BINARY_DIR}/${package}ConfigVersion.cmake" 59 DESTINATION "${poafloc_INSTALL_CMAKEDIR}" 60 COMPONENT poafloc_Development 61 ) 62 63 install( 64 EXPORT poaflocTargets 65 NAMESPACE poafloc:: 66 DESTINATION "${poafloc_INSTALL_CMAKEDIR}" 67 COMPONENT poafloc_Development 68 ) 69 70 if(PROJECT_IS_TOP_LEVEL) 71 include(CPack) 72 endif()