mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-27 04:09:36 +03:00
When VERIFY_INTERFACE_FILE_SETS is set to true on an executable target, verification of that target's interface file sets was only being performed if the target's ENABLE_EXPORTS property was set to true. We now always verify the interface file sets of executable targets, subject to the new CMP0209 policy. This allows interface file sets to be verified even for executable targets that do not export symbols. Interface file sets containing headers that are fully inlined is an example use case for this scenario. Unit test executables may link to the executable under test, possibly with $<COMPILE_ONLY:...>. Issue: #23448 #27046
17 lines
551 B
CMake
17 lines
551 B
CMake
enable_language(C CXX)
|
|
|
|
add_compile_definitions(TEST_ADD_COMPILE_DEFINITIONS)
|
|
|
|
set_property(SOURCE a.h PROPERTY LANGUAGE C)
|
|
set_property(SOURCE dir/c.h PROPERTY LANGUAGE C)
|
|
set_property(SOURCE dir/cxx.h PROPERTY LANGUAGE CXX)
|
|
|
|
set(CMAKE_VERIFY_INTERFACE_HEADER_SETS ON)
|
|
|
|
add_executable(exe main.c)
|
|
target_sources(exe INTERFACE FILE_SET HEADERS FILES a.h dir/c.h dir/cxx.h)
|
|
|
|
add_executable(export_exe main.c)
|
|
set_property(TARGET export_exe PROPERTY ENABLE_EXPORTS TRUE)
|
|
target_sources(export_exe INTERFACE FILE_SET HEADERS FILES a.h dir/c.h dir/cxx.h)
|