Merge pull request #4188 from Mizzrym1:component

PiperOrigin-RevId: 539684886
Change-Id: Ie7f4175ad413fdb82d265374a4aca9fad23571f5
This commit is contained in:
Copybara-Service 2023-06-12 09:58:37 -07:00
commit e9078161e6
2 changed files with 6 additions and 0 deletions

View File

@ -100,12 +100,14 @@ if (INSTALL_GTEST)
set(version_file "${generated_dir}/${cmake_package_name}ConfigVersion.cmake") set(version_file "${generated_dir}/${cmake_package_name}ConfigVersion.cmake")
write_basic_package_version_file(${version_file} VERSION ${GOOGLETEST_VERSION} COMPATIBILITY AnyNewerVersion) write_basic_package_version_file(${version_file} VERSION ${GOOGLETEST_VERSION} COMPATIBILITY AnyNewerVersion)
install(EXPORT ${targets_export_name} install(EXPORT ${targets_export_name}
COMPONENT "${PROJECT_NAME}"
NAMESPACE ${cmake_package_name}:: NAMESPACE ${cmake_package_name}::
DESTINATION ${cmake_files_install_dir}) DESTINATION ${cmake_files_install_dir})
set(config_file "${generated_dir}/${cmake_package_name}Config.cmake") set(config_file "${generated_dir}/${cmake_package_name}Config.cmake")
configure_package_config_file("${gtest_SOURCE_DIR}/cmake/Config.cmake.in" configure_package_config_file("${gtest_SOURCE_DIR}/cmake/Config.cmake.in"
"${config_file}" INSTALL_DESTINATION ${cmake_files_install_dir}) "${config_file}" INSTALL_DESTINATION ${cmake_files_install_dir})
install(FILES ${version_file} ${config_file} install(FILES ${version_file} ${config_file}
COMPONENT "${PROJECT_NAME}"
DESTINATION ${cmake_files_install_dir}) DESTINATION ${cmake_files_install_dir})
endif() endif()

View File

@ -341,10 +341,12 @@ endfunction()
function(install_project) function(install_project)
if(INSTALL_GTEST) if(INSTALL_GTEST)
install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/" install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/"
COMPONENT "${PROJECT_NAME}"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
# Install the project targets. # Install the project targets.
install(TARGETS ${ARGN} install(TARGETS ${ARGN}
EXPORT ${targets_export_name} EXPORT ${targets_export_name}
COMPONENT "${PROJECT_NAME}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
@ -356,6 +358,7 @@ function(install_project)
get_target_property(t_pdb_output_directory ${t} PDB_OUTPUT_DIRECTORY) get_target_property(t_pdb_output_directory ${t} PDB_OUTPUT_DIRECTORY)
install(FILES install(FILES
"${t_pdb_output_directory}/\${CMAKE_INSTALL_CONFIG_NAME}/$<$<CONFIG:Debug>:${t_pdb_name_debug}>$<$<NOT:$<CONFIG:Debug>>:${t_pdb_name}>.pdb" "${t_pdb_output_directory}/\${CMAKE_INSTALL_CONFIG_NAME}/$<$<CONFIG:Debug>:${t_pdb_name_debug}>$<$<NOT:$<CONFIG:Debug>>:${t_pdb_name}>.pdb"
COMPONENT "${PROJECT_NAME}"
DESTINATION ${CMAKE_INSTALL_LIBDIR} DESTINATION ${CMAKE_INSTALL_LIBDIR}
OPTIONAL) OPTIONAL)
endforeach() endforeach()
@ -366,6 +369,7 @@ function(install_project)
configure_file("${PROJECT_SOURCE_DIR}/cmake/${t}.pc.in" configure_file("${PROJECT_SOURCE_DIR}/cmake/${t}.pc.in"
"${configured_pc}" @ONLY) "${configured_pc}" @ONLY)
install(FILES "${configured_pc}" install(FILES "${configured_pc}"
COMPONENT "${PROJECT_NAME}"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
endforeach() endforeach()
endif() endif()