From 281c2936f3991800896220eb40fd03a2ea669a33 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 23 Mar 2023 00:36:44 -0400 Subject: [PATCH] cmake: Update install rules to support component-based installation --- build/cmake/CMakeLists.txt | 20 +++++++++++++------- build/cmake/testbuild/CMakeLists.txt | 2 +- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/build/cmake/CMakeLists.txt b/build/cmake/CMakeLists.txt index 9afcf2a..ef42af9 100644 --- a/build/cmake/CMakeLists.txt +++ b/build/cmake/CMakeLists.txt @@ -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 $ 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) diff --git a/build/cmake/testbuild/CMakeLists.txt b/build/cmake/testbuild/CMakeLists.txt index 27bcf2d..15b9e52 100644 --- a/build/cmake/testbuild/CMakeLists.txt +++ b/build/cmake/testbuild/CMakeLists.txt @@ -22,4 +22,4 @@ target_compile_definitions(cmake-test PRIVATE -DGLEW_CMAKE_TEST_TARGET_TYPE=$ ) -install(TARGETS cmake-test DESTINATION bin) +install(TARGETS cmake-test DESTINATION bin COMPONENT Runtime)