cmake: Update install rules to support component-based installation

This commit is contained in:
Jean-Christophe Fillion-Robin 2023-03-23 00:36:44 -04:00 committed by Nigel Stewart
parent ef7d12ecb7
commit 281c2936f3
2 changed files with 14 additions and 8 deletions

View File

@ -197,10 +197,10 @@ endif()
install ( TARGETS ${targets_to_install}
${MAYBE_EXPORT}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
FRAMEWORK DESTINATION ${CMAKE_INSTALL_PREFIX}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT Runtime
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Runtime
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Development
FRAMEWORK DESTINATION ${CMAKE_INSTALL_PREFIX} COMPONENT Runtime
)
if (BUILD_UTILS)
@ -233,7 +233,8 @@ if (BUILD_UTILS)
endif ()
install ( TARGETS glewinfo visualinfo
DESTINATION ${CMAKE_INSTALL_BINDIR})
DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT Runtime)
endif ()
set (prefix ${CMAKE_INSTALL_PREFIX})
@ -254,6 +255,7 @@ configure_file (${GLEW_DIR}/glew.pc.in ${CMAKE_CURRENT_BINARY_DIR}/glew.pc @ONLY
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/glew.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
COMPONENT Development
)
if(WIN32 AND MSVC AND (NOT MSVC_VERSION LESS 1600) AND (NOT CMAKE_VERSION VERSION_LESS "3.1"))
@ -261,20 +263,24 @@ if(WIN32 AND MSVC AND (NOT MSVC_VERSION LESS 1600) AND (NOT CMAKE_VERSION VERSIO
FILES $<TARGET_PDB_FILE:glew>
DESTINATION ${CMAKE_INSTALL_LIBDIR}
CONFIGURATIONS Debug RelWithDebInfo
COMPONENT Runtime
)
endif()
install (
FILES ${GLEW_PUBLIC_HEADERS_FILES}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/GL)
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/GL
COMPONENT Development)
if(MAYBE_EXPORT)
install(EXPORT glew-targets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/glew
COMPONENT Development
NAMESPACE GLEW::)
install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/glew-config.cmake
${CMAKE_CURRENT_SOURCE_DIR}/CopyImportedTargetProperties.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/glew)
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/glew
COMPONENT Development)
endif()
if(NOT TARGET uninstall)

View File

@ -22,4 +22,4 @@ target_compile_definitions(cmake-test PRIVATE
-DGLEW_CMAKE_TEST_TARGET_TYPE=$<TARGET_PROPERTY:GLEW::GLEW,TYPE>
)
install(TARGETS cmake-test DESTINATION bin)
install(TARGETS cmake-test DESTINATION bin COMPONENT Runtime)