mirror of
https://github.com/reactos/CMake.git
synced 2024-12-12 05:45:51 +00:00
Honor $<LINK_ONLY> when checking interface properties
Callers of cmTarget::GetLinkImplementationClosure are interested in the set of targets whose interface properties propagate to the current target. This excludes targets guarded by $<LINK_ONLY>. Teach the CompatibleInterface test to cover suppression of interface compatibility tests with $<LINK_ONLY>. Although this is not recommended in practice, it is a way of covering the above behavior.
This commit is contained in:
parent
0400cd5dd1
commit
6e7e881c57
@ -6018,7 +6018,7 @@ void processILibs(const std::string& config,
|
||||
{
|
||||
tgts.push_back(item.Target);
|
||||
if(cmTarget::LinkInterface const* iface =
|
||||
item.Target->GetLinkInterfaceLibraries(config, headTarget, false))
|
||||
item.Target->GetLinkInterfaceLibraries(config, headTarget, true))
|
||||
{
|
||||
for(std::vector<cmLinkItem>::const_iterator
|
||||
it = iface->Libraries.begin();
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
project(CompatibleInterface)
|
||||
|
||||
@ -54,6 +54,15 @@ set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MAX_PROP2 200)
|
||||
add_executable(CompatibleInterface main.cpp)
|
||||
target_link_libraries(CompatibleInterface iface1)
|
||||
|
||||
add_library(foo STATIC foo.cpp)
|
||||
add_library(bar SHARED bar.cpp)
|
||||
set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SOMEPROP)
|
||||
set_property(TARGET foo PROPERTY INTERFACE_SOMEPROP ON)
|
||||
# Use LINK_ONLY to suppress usage requirements and allow the check to pass.
|
||||
set_property(TARGET bar PROPERTY INTERFACE_LINK_LIBRARIES $<LINK_ONLY:foo>)
|
||||
set_property(TARGET CompatibleInterface PROPERTY SOMEPROP OFF)
|
||||
target_link_libraries(CompatibleInterface bar)
|
||||
|
||||
set_property(TARGET CompatibleInterface PROPERTY BOOL_PROP2 ON)
|
||||
set_property(TARGET CompatibleInterface PROPERTY BOOL_PROP3 ON)
|
||||
set_property(TARGET CompatibleInterface PROPERTY STRING_PROP2 prop2)
|
||||
|
7
Tests/CompatibleInterface/bar.cpp
Normal file
7
Tests/CompatibleInterface/bar.cpp
Normal file
@ -0,0 +1,7 @@
|
||||
#ifdef _WIN32
|
||||
__declspec(dllexport)
|
||||
#endif
|
||||
int bar()
|
||||
{
|
||||
return 0;
|
||||
}
|
4
Tests/CompatibleInterface/foo.cpp
Normal file
4
Tests/CompatibleInterface/foo.cpp
Normal file
@ -0,0 +1,4 @@
|
||||
int foo()
|
||||
{
|
||||
return 0;
|
||||
}
|
@ -40,8 +40,14 @@ enum {
|
||||
|
||||
#include "iface2.h"
|
||||
|
||||
int foo();
|
||||
#ifdef _WIN32
|
||||
__declspec(dllimport)
|
||||
#endif
|
||||
int bar();
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
Iface2 if2;
|
||||
return if2.foo();
|
||||
return if2.foo() + foo() + bar();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user