mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 21:59:54 -06:00
If an INTERFACE library has HEADER_SETS, and its header sets contain files generated by a custom command, the library needs to participate in the buildsystem so that the files will be generated. Fixes: #23422
13 lines
470 B
CMake
13 lines
470 B
CMake
enable_language(C)
|
|
|
|
add_library(lib INTERFACE)
|
|
add_custom_command(
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/dependency.h
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/FileSetGeneratedDependency.h.in ${CMAKE_CURRENT_BINARY_DIR}/dependency.h
|
|
VERBATIM
|
|
)
|
|
target_sources(lib PUBLIC FILE_SET HEADERS BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR} FILES ${CMAKE_CURRENT_BINARY_DIR}/dependency.h)
|
|
|
|
add_executable(exe dependency.c)
|
|
target_link_libraries(exe PRIVATE lib)
|