mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-23 07:28:51 -06:00
Commit b04f3b9a (Create make rules for INTERFACE_LIBRARY
targets., 2013-08-21) extended the makefile generator to create
build targets for INTERFACE_LIBRARY targets. No other generators
were extended with this feature.
This conflicts with the feature of whitelisting of target properties
read from INTERFACE_LIBRARY targets. The INTERFACE_* properties
of the INTERFACE_LIBRARY may legitimately contain TARGET_PROPERTY
generator expressions for reading properties from the 'head target'.
The 'head target' would be the INTERFACE_LIBRARY itself when creating
the build rules for it, which means that non-whitelisted properties
would be read.
30 lines
961 B
CMake
30 lines
961 B
CMake
|
|
cmake_minimum_required(VERSION 2.8)
|
|
|
|
project(InterfaceLibrary)
|
|
|
|
add_library(iface_nodepends INTERFACE)
|
|
target_compile_definitions(iface_nodepends INTERFACE IFACE_DEFINE)
|
|
|
|
add_executable(InterfaceLibrary definetestexe.cpp)
|
|
target_link_libraries(InterfaceLibrary iface_nodepends)
|
|
|
|
add_subdirectory(libsdir)
|
|
|
|
add_executable(sharedlibtestexe sharedlibtestexe.cpp)
|
|
target_link_libraries(sharedlibtestexe shared_iface)
|
|
|
|
add_library(broken EXCLUDE_FROM_ALL broken.cpp)
|
|
|
|
add_library(iface_broken INTERFACE)
|
|
# This is not a dependency, so broken will not be built (and the error in
|
|
# it will not be hit)
|
|
target_link_libraries(iface_broken INTERFACE broken)
|
|
|
|
add_library(iface_whitelist INTERFACE)
|
|
# The target property CUSTOM will never be evaluated on the INTERFACE library.
|
|
target_link_libraries(iface_whitelist INTERFACE $<$<BOOL:$<TARGET_PROPERTY:CUSTOM>>:irrelevant>)
|
|
|
|
add_executable(exec_whitelist dummy.cpp)
|
|
target_link_libraries(exec_whitelist iface_whitelist)
|