install-rules.cmake (1818B)
1 if(PROJECT_IS_TOP_LEVEL) 2 set( 3 CMAKE_INSTALL_INCLUDEDIR "include/stamen-${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 stamen) 14 15 install( 16 DIRECTORY 17 include/ 18 "${PROJECT_BINARY_DIR}/export/" 19 DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" 20 COMPONENT stamen_Development 21 ) 22 23 install( 24 TARGETS stamen_stamen 25 EXPORT stamenTargets 26 RUNTIME # 27 COMPONENT stamen_Runtime 28 LIBRARY # 29 COMPONENT stamen_Runtime 30 NAMELINK_COMPONENT stamen_Development 31 ARCHIVE # 32 COMPONENT stamen_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 stamen_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/${package}" 45 CACHE STRING "CMake package config location relative to the install prefix" 46 ) 47 set_property(CACHE stamen_INSTALL_CMAKEDIR PROPERTY TYPE PATH) 48 mark_as_advanced(stamen_INSTALL_CMAKEDIR) 49 50 install( 51 FILES cmake/install-config.cmake 52 DESTINATION "${stamen_INSTALL_CMAKEDIR}" 53 RENAME "${package}Config.cmake" 54 COMPONENT stamen_Development 55 ) 56 57 install( 58 FILES "${PROJECT_BINARY_DIR}/${package}ConfigVersion.cmake" 59 DESTINATION "${stamen_INSTALL_CMAKEDIR}" 60 COMPONENT stamen_Development 61 ) 62 63 install( 64 EXPORT stamenTargets 65 NAMESPACE stamen:: 66 DESTINATION "${stamen_INSTALL_CMAKEDIR}" 67 COMPONENT stamen_Development 68 ) 69 70 install( 71 TARGETS stamen_exe 72 RUNTIME COMPONENT stamen_Runtime 73 ) 74 75 if(PROJECT_IS_TOP_LEVEL) 76 include(CPack) 77 endif()