Ver Fonte

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
Brad King há 2 dias atrás
pai
commit
4671e77845
1 ficheiros alterados com 1 adições e 3 exclusões
  1. 1 3
      Modules/GenerateExportHeader.cmake

+ 1 - 3
Modules/GenerateExportHeader.cmake

@@ -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