mirror of
https://github.com/Kitware/CMake.git
synced 2026-11-06 05:16:58 +00:00
Add `install_prep/<component>` convenience targets to the Ninja
generators to build dependencies of install components, and
`install_prep/all` to build the dependencies of all install components.
This is similar in flavor to commit ba6b6fbc24 (Ninja: Add Build
Dependencies for Tests, 2026-04-07), but here for the install command.
Co-authored-by: Tyler Yankee <tyler.yankee@kitware.com>
Issue: #27643
34 lines
880 B
CMake
34 lines
880 B
CMake
include(GeneratedCommon.cmake)
|
|
|
|
add_generated_file(generated_header generated.h)
|
|
add_library(generated_headers STATIC EXCLUDE_FROM_ALL
|
|
"${generated_target_source}")
|
|
target_sources(generated_headers PUBLIC
|
|
FILE_SET HEADERS
|
|
BASE_DIRS "${CMAKE_CURRENT_BINARY_DIR}"
|
|
FILES "${generated_header}"
|
|
)
|
|
install(TARGETS generated_headers
|
|
ARCHIVE DESTINATION lib
|
|
COMPONENT Archive
|
|
EXCLUDE_FROM_ALL
|
|
FILE_SET HEADERS DESTINATION include
|
|
COMPONENT Headers
|
|
)
|
|
|
|
# A file set without generated files does not need its target built.
|
|
add_library(plain_headers STATIC EXCLUDE_FROM_ALL neverbuild.c)
|
|
target_sources(plain_headers PUBLIC
|
|
FILE_SET HEADERS
|
|
FILES plain.h
|
|
)
|
|
install(TARGETS plain_headers
|
|
ARCHIVE DESTINATION lib
|
|
COMPONENT Archive
|
|
EXCLUDE_FROM_ALL
|
|
FILE_SET HEADERS DESTINATION include
|
|
COMPONENT Headers
|
|
)
|
|
|
|
add_library(unit_tests STATIC neverbuild.c)
|