diff --git a/Tests/CustomTransitiveProperties/CMakeLists.txt b/Tests/CustomTransitiveProperties/CMakeLists.txt index 4d2a0aa81a..128687f15d 100644 --- a/Tests/CustomTransitiveProperties/CMakeLists.txt +++ b/Tests/CustomTransitiveProperties/CMakeLists.txt @@ -90,6 +90,18 @@ target_compile_definitions(CustomTransitiveProperties PRIVATE $ ) +# Test TRANSITIVE_LINK_PROPERTIES containing LINK_LIBRARIES itself. +add_library(iface10 INTERFACE) +set_property(TARGET iface10 PROPERTY TRANSITIVE_LINK_PROPERTIES "LINK_LIBRARIES") +add_library(iface11 INTERFACE) +target_link_libraries(iface11 INTERFACE iface10) +add_library(static10 STATIC static10.c) +target_link_libraries(static10 PRIVATE iface11) +add_library(static11 STATIC static11.c) +target_link_libraries(static11 PRIVATE static10 iface11) +add_executable(main10 main10.c) +target_link_libraries(main10 PRIVATE static11 static10) + # Test TRANSITIVE_*_PROPERTY evaluation outside of usage requirements. add_executable(check-args check-args.c) set(out "${CMAKE_CURRENT_BINARY_DIR}/out-$.txt") @@ -136,6 +148,16 @@ static1 LINK_LIBRARIES: '$' static1 INTERFACE_LINK_LIBRARIES: '$' main LINK_LIBRARIES: '$' main INTERFACE_LINK_LIBRARIES: '$' +iface10 LINK_LIBRARIES: '$' +iface10 INTERFACE_LINK_LIBRARIES: '$' +iface11 LINK_LIBRARIES: '$' +iface11 INTERFACE_LINK_LIBRARIES: '$' +static10 LINK_LIBRARIES: '$' +static10 INTERFACE_LINK_LIBRARIES: '$' +static11 LINK_LIBRARIES: '$' +static11 INTERFACE_LINK_LIBRARIES: '$' +main10 LINK_LIBRARIES: '$' +main10 INTERFACE_LINK_LIBRARIES: '$' ]====]) file(GENERATE OUTPUT "${out}" CONTENT "# file(GENERATE) produced: ${in_CUSTOM} @@ -168,4 +190,26 @@ add_custom_target(check ALL VERBATIM "$" "$" "$" "static1;object1" "$" "" + COMMAND check-args + "$" "" + "$" "" + "$" "" + "$" "iface10" + "$" "iface11;iface10" + # _/ \__ + # / \ + # "static10[iface11];iface11[iface10]" + "$" "iface11;iface10" + "$" "static10;iface11;iface11;iface10;iface10" + # / / \ \ \___ extra! + # __/ __/ \__ \__________ + # / / \ \ + # "static11[static10;iface11];static10[iface11;iface11[iface10]]" + "$" "static10;iface11;iface11;iface10;iface10" + "$" "static11;static10;static10;iface11;iface11;iface10;iface10;iface11;iface10" + # / / | | \ \ \_______\_______\____ extra! + # _______/ _______/ | | \______ \______________ + # / / | | \ \ + # "main10[static11;static10];static11[static10;iface11;static10[iface11;iface11[iface10]]]" + "$" "" ) diff --git a/Tests/CustomTransitiveProperties/check.cmake b/Tests/CustomTransitiveProperties/check.cmake index 9d4408c74a..31a5c9f5b2 100644 --- a/Tests/CustomTransitiveProperties/check.cmake +++ b/Tests/CustomTransitiveProperties/check.cmake @@ -41,6 +41,16 @@ static1 LINK_LIBRARIES: 'iface2' static1 INTERFACE_LINK_LIBRARIES: '\$' main LINK_LIBRARIES: 'static1;object1' main INTERFACE_LINK_LIBRARIES: '' +iface10 LINK_LIBRARIES: '' +iface10 INTERFACE_LINK_LIBRARIES: '' +iface11 LINK_LIBRARIES: '' +iface11 INTERFACE_LINK_LIBRARIES: 'iface10' +static10 LINK_LIBRARIES: 'iface11;iface10' +static10 INTERFACE_LINK_LIBRARIES: 'iface11;iface10' +static11 LINK_LIBRARIES: 'static10;iface11;iface11;iface10;iface10' +static11 INTERFACE_LINK_LIBRARIES: 'static10;iface11;iface11;iface10;iface10' +main10 LINK_LIBRARIES: 'static11;static10;static10;iface11;iface11;iface10;iface10;iface11;iface10' +main10 INTERFACE_LINK_LIBRARIES: '' ]]) string(REGEX REPLACE "\r\n" "\n" expect "${expect}") string(REGEX REPLACE "\n+$" "" expect "${expect}") diff --git a/Tests/CustomTransitiveProperties/main10.c b/Tests/CustomTransitiveProperties/main10.c new file mode 100644 index 0000000000..369683c69b --- /dev/null +++ b/Tests/CustomTransitiveProperties/main10.c @@ -0,0 +1,7 @@ +extern int static10(void); +extern int static11(void); + +int main(void) +{ + return static10() + static11(); +} diff --git a/Tests/CustomTransitiveProperties/static10.c b/Tests/CustomTransitiveProperties/static10.c new file mode 100644 index 0000000000..6359f220de --- /dev/null +++ b/Tests/CustomTransitiveProperties/static10.c @@ -0,0 +1,4 @@ +int static10(void) +{ + return 0; +} diff --git a/Tests/CustomTransitiveProperties/static11.c b/Tests/CustomTransitiveProperties/static11.c new file mode 100644 index 0000000000..0ba822df91 --- /dev/null +++ b/Tests/CustomTransitiveProperties/static11.c @@ -0,0 +1,4 @@ +int static11(void) +{ + return 0; +}