GenerateExportHeader: Fix FILE_SET example BASE_DIRS

In commit 12ec3270c4 (GenerateExportHeader: Extend documentation,
2025-05-06, v4.1.0-rc1~214^2) we added a `BASE_DIRS` example value using
a generator expression that cannot be correctly consumed after export.
Update the example to use `CMAKE_CURRENT_BINARY_DIR`, which is where
`generate_export_header` places the header anyway.  Also drop the
explicit `target_include_directories`, as it is not needed when
using a file set for the header.

Closes: #27620
This commit is contained in:
Brad King
2026-02-19 08:55:17 -05:00
parent cc05acf0a1
commit 4671e77845

View File

@@ -258,12 +258,10 @@ library's other public headers:
FILES example.h
FILE_SET generated_headers
TYPE HEADERS
BASE_DIRS $<TARGET_PROPERTY:example,BINARY_DIR>
BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR}
FILES ${CMAKE_CURRENT_BINARY_DIR}/example_export.h
)
target_include_directories(example PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
install(
TARGETS example
FILE_SET HEADERS