Для библиотек добавлена цель вида ${target}-install-headers

This commit is contained in:
Andrei Astafev 2021-12-13 13:57:11 +03:00
parent e81a491606
commit 4851c81b15

View File

@ -71,6 +71,13 @@ function(myx_cmake_common_target_properties target)
set_target_properties(${target} PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
if(_target_type MATCHES "_LIBRARY$" AND NOT ${target}-install-headers)
# Цель, используемая только для установки заголовочных файлов без компиляции проекта
add_custom_target(${target}-install-headers
COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=dev
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
endif()
# LTO only for executables (not libraries) in Release build type
if(_target_type STREQUAL EXECUTABLE AND CMAKE_BUILD_TYPE STREQUAL Release)
check_cxx_compiler_flag(-flto CXX_HAS_LTO_FLAG)