Test non-IMPORTED libraries in the INTERFACE of IMPORTED libraries.
If a non-IMPORTED library is added to the INTERFACE_LINK_LIBRARIES
of a IMPORTED target, the non-IMPORTED target needs to become a
target dependency and link dependency of the consuming target.
This is already the case since commit 30962029
(Make targets depend
on the link interface of their dependees, 2012-12-26), and fixed in
the parent commit, so test that it works.
This commit is contained in:
parent
340535156d
commit
4f7ceb56d1
|
@ -185,6 +185,9 @@ set_property(TARGET testSharedLibRequired APPEND PROPERTY
|
||||||
INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include/testSharedLibRequired>"
|
INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include/testSharedLibRequired>"
|
||||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}>"
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}>"
|
||||||
)
|
)
|
||||||
|
set_property(TARGET testSharedLibRequired APPEND PROPERTY
|
||||||
|
INTERFACE_COMPILE_DEFINITIONS USING_TESTSHAREDLIBREQUIRED
|
||||||
|
)
|
||||||
set_property(TARGET testSharedLibRequired
|
set_property(TARGET testSharedLibRequired
|
||||||
APPEND PROPERTY
|
APPEND PROPERTY
|
||||||
COMPATIBLE_INTERFACE_BOOL CUSTOM_PROP
|
COMPATIBLE_INTERFACE_BOOL CUSTOM_PROP
|
||||||
|
|
|
@ -205,3 +205,36 @@ target_compile_definitions(deps_shared_iface2
|
||||||
$<$<BOOL:$<TARGET_PROPERTY:CUSTOM_PROP>>:CUSTOM_PROPERTY_IS_ON>
|
$<$<BOOL:$<TARGET_PROPERTY:CUSTOM_PROP>>:CUSTOM_PROPERTY_IS_ON>
|
||||||
$<$<STREQUAL:$<TARGET_PROPERTY:CUSTOM_STRING>,testcontent>:CUSTOM_STRING_IS_MATCH>
|
$<$<STREQUAL:$<TARGET_PROPERTY:CUSTOM_STRING>,testcontent>:CUSTOM_STRING_IS_MATCH>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_subdirectory(excludedFromAll)
|
||||||
|
|
||||||
|
add_executable(iface_test_bld iface_test.cpp)
|
||||||
|
target_link_libraries(iface_test_bld bld_testSharedLibDepends)
|
||||||
|
|
||||||
|
set_property(TARGET bld_testSharedLibRequired APPEND PROPERTY
|
||||||
|
LINK_INTERFACE_LIBRARIES
|
||||||
|
excludedFromAll
|
||||||
|
)
|
||||||
|
get_target_property(_configs bld_testSharedLibRequired IMPORTED_CONFIGURATIONS)
|
||||||
|
foreach(_config ${_configs})
|
||||||
|
set_property(TARGET bld_testSharedLibRequired APPEND PROPERTY
|
||||||
|
IMPORTED_LINK_INTERFACE_LIBRARIES_${_config}
|
||||||
|
excludedFromAll
|
||||||
|
)
|
||||||
|
endforeach()
|
||||||
|
unset(_configs)
|
||||||
|
add_executable(iface_test_exp iface_test.cpp)
|
||||||
|
target_link_libraries(iface_test_exp testSharedLibDepends)
|
||||||
|
|
||||||
|
set_property(TARGET testSharedLibDepends APPEND PROPERTY
|
||||||
|
LINK_INTERFACE_LIBRARIES
|
||||||
|
excludedFromAll
|
||||||
|
)
|
||||||
|
get_target_property(_configs testSharedLibDepends IMPORTED_CONFIGURATIONS)
|
||||||
|
foreach(_config ${_configs})
|
||||||
|
set_property(TARGET testSharedLibDepends APPEND PROPERTY
|
||||||
|
IMPORTED_LINK_INTERFACE_LIBRARIES_${_config}
|
||||||
|
excludedFromAll
|
||||||
|
)
|
||||||
|
endforeach()
|
||||||
|
unset(_configs)
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
|
||||||
|
set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
|
||||||
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||||
|
|
||||||
|
include(GenerateExportHeader)
|
||||||
|
add_library(excludedFromAll SHARED EXCLUDE_FROM_ALL excludedFromAll.cpp)
|
||||||
|
generate_export_header(excludedFromAll)
|
|
@ -0,0 +1,7 @@
|
||||||
|
|
||||||
|
#include "excludedFromAll.h"
|
||||||
|
|
||||||
|
int excludedFromAll()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
|
||||||
|
#include "excludedfromall_export.h"
|
||||||
|
|
||||||
|
int EXCLUDEDFROMALL_EXPORT excludedFromAll();
|
|
@ -0,0 +1,11 @@
|
||||||
|
|
||||||
|
#ifndef USING_TESTSHAREDLIBREQUIRED
|
||||||
|
#error Expected USING_TESTSHAREDLIBREQUIRED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "excludedFromAll.h"
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
return excludedFromAll();
|
||||||
|
}
|
Loading…
Reference in New Issue