Files
Matthew Woehlke a5b38fb898 CPS: Implement exporting of file sets
Add (partial) file set export to CPS. For now, only headers ("includes")
are supported, as that is the only overlap with the specification.
(Source file sets are not supported by CPS at this time, and the hope is
that C++ modules will never be supported, as that information should
already be available via the `cpp_module_metadata` information.) CPS
also supports "embeds", but CMake doesn't (yet).

This also introduces our first official use of CPS extensions, used to
record the CMake file set name.
2026-06-30 15:08:02 -04:00

47 lines
742 B
CMake

add_library(foo INTERFACE)
target_sources(foo
INTERFACE
FILE_SET no_genex
TYPE HEADERS
BASE_DIRS foo
FILES
foo/header1.h
foo/header2.h
INTERFACE
FILE_SET no_genex_dup
TYPE HEADERS
BASE_DIRS foo
FILES
foo/header1.h
foo/header2.h
INTERFACE
FILE_SET genex
TYPE HEADERS
INTERFACE
FILE_SET genex_dup
TYPE HEADERS
)
install(
TARGETS foo
EXPORT foo
DESTINATION .
FILE_SET no_genex
DESTINATION no_genex
FILE_SET no_genex_dup
DESTINATION no_genex
FILE_SET genex
DESTINATION $<$<CONFIG:FAKE_CONFIG>:FAKE_DEST>genex
FILE_SET genex_dup
DESTINATION $<$<CONFIG:FAKE_CONFIG>:FAKE_DEST>genex
)
install(PACKAGE_INFO foo DESTINATION cps EXPORT foo)