Export targets from top-level CMake file

With some slight reordering of the code
This commit is contained in:
Krzysztof Kurek 2021-01-30 23:35:37 +01:00
parent 3e99386b6f
commit 631faffab3
No known key found for this signature in database
GPG Key ID: 04CCC8030ECE248C
2 changed files with 7 additions and 6 deletions

View File

@ -22,13 +22,18 @@ add_library(glm::glm ALIAS glm)
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
include(CPack)
include(GNUInstallDirs)
install(TARGETS glm EXPORT glm)
install(DIRECTORY glm TYPE INCLUDE PATTERN "CMakeLists.txt" EXCLUDE)
install(EXPORT glm FILE glmConfig.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/glm NAMESPACE glm::)
include(CMakePackageConfigHelpers)
write_basic_package_version_file("glmConfigVersion.cmake" COMPATIBILITY AnyNewerVersion ARCH_INDEPENDENT)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/glmConfigVersion.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/glm)
enable_testing()
add_subdirectory(test)
include(CTest)
if(BUILD_TESTING)
add_subdirectory(test)
endif()
endif(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})

View File

@ -49,10 +49,6 @@ target_include_directories(glm INTERFACE
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
include(GNUInstallDirs)
install(TARGETS glm EXPORT glm)
install(DIRECTORY . DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/glm" PATTERN "CMakeLists.txt" EXCLUDE)
if(BUILD_STATIC_LIBS)
add_library(glm_static STATIC ${ROOT_TEXT} ${ROOT_MD} ${ROOT_NAT}
${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER}