You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
3.8 KiB
71 lines
3.8 KiB
cmake_minimum_required (VERSION 2.8)
|
|
|
|
cmake_policy(SET CMP0022 NEW)
|
|
|
|
project(InterfaceLinkLibraries)
|
|
|
|
add_library(foo_shared SHARED foo_vs6_1.cpp)
|
|
target_compile_definitions(foo_shared INTERFACE FOO_LIBRARY)
|
|
add_library(bar_shared SHARED bar_vs6_1.cpp)
|
|
target_compile_definitions(bar_shared INTERFACE BAR_LIBRARY)
|
|
set_property(TARGET bar_shared APPEND PROPERTY INTERFACE_LINK_LIBRARIES foo_shared)
|
|
add_library(zot_shared SHARED zot_vs6_1.cpp)
|
|
target_compile_definitions(zot_shared INTERFACE ZOT_LIBRARY)
|
|
set_property(TARGET bar_shared APPEND PROPERTY INTERFACE_LINK_LIBRARIES $<LINK_ONLY:zot_shared>)
|
|
|
|
add_executable(shared_test main_vs6_1.cpp)
|
|
set_property(TARGET shared_test APPEND PROPERTY LINK_LIBRARIES bar_shared)
|
|
|
|
add_library(foo_static STATIC foo_vs6_2.cpp)
|
|
target_compile_definitions(foo_static INTERFACE FOO_LIBRARY)
|
|
add_library(bar_static STATIC bar_vs6_2.cpp)
|
|
target_compile_definitions(bar_static INTERFACE BAR_LIBRARY)
|
|
set_property(TARGET bar_static APPEND PROPERTY INTERFACE_LINK_LIBRARIES foo_static)
|
|
add_library(zot_static STATIC zot_vs6_2.cpp)
|
|
target_compile_definitions(zot_static INTERFACE ZOT_LIBRARY)
|
|
set_property(TARGET bar_static APPEND PROPERTY INTERFACE_LINK_LIBRARIES $<LINK_ONLY:zot_static>)
|
|
|
|
add_executable(static_test main_vs6_2.cpp)
|
|
set_property(TARGET static_test APPEND PROPERTY LINK_LIBRARIES bar_static)
|
|
|
|
add_library(foo_shared_private SHARED foo_vs6_3.cpp)
|
|
target_compile_definitions(foo_shared_private INTERFACE FOO_LIBRARY)
|
|
add_library(bang_shared_private SHARED bang_vs6_1.cpp)
|
|
target_compile_definitions(bang_shared_private INTERFACE BANG_LIBRARY)
|
|
add_library(bar_shared_private SHARED bar_vs6_3.cpp)
|
|
target_compile_definitions(bar_shared_private INTERFACE BAR_LIBRARY)
|
|
target_compile_definitions(bar_shared_private PRIVATE BAR_USE_BANG)
|
|
set_property(TARGET bar_shared_private APPEND PROPERTY LINK_LIBRARIES bang_shared_private)
|
|
set_property(TARGET bar_shared_private APPEND PROPERTY INTERFACE_LINK_LIBRARIES foo_shared_private)
|
|
add_library(zot_shared_private SHARED zot_vs6_3.cpp)
|
|
target_compile_definitions(zot_shared_private INTERFACE ZOT_LIBRARY)
|
|
set_property(TARGET bar_shared_private APPEND PROPERTY INTERFACE_LINK_LIBRARIES $<LINK_ONLY:zot_shared_private>)
|
|
|
|
add_executable(shared_private_test main_vs6_3.cpp)
|
|
set_property(TARGET shared_private_test APPEND PROPERTY LINK_LIBRARIES bar_shared_private)
|
|
|
|
add_library(foo_static_private STATIC foo_vs6_4.cpp)
|
|
target_compile_definitions(foo_static_private INTERFACE FOO_LIBRARY)
|
|
add_library(bang_static_private STATIC bang_vs6_2.cpp)
|
|
target_compile_definitions(bang_static_private INTERFACE BANG_LIBRARY)
|
|
add_library(bar_static_private STATIC bar_vs6_4.cpp)
|
|
target_compile_definitions(bar_static_private INTERFACE BAR_LIBRARY)
|
|
target_compile_definitions(bar_static_private PRIVATE BAR_USE_BANG)
|
|
set_property(TARGET bar_static_private APPEND PROPERTY LINK_LIBRARIES bang_static_private)
|
|
set_property(TARGET bar_static_private APPEND PROPERTY INTERFACE_LINK_LIBRARIES $<LINK_ONLY:bang_static_private> foo_static_private)
|
|
add_library(zot_static_private STATIC zot_vs6_4.cpp)
|
|
target_compile_definitions(zot_static_private INTERFACE ZOT_LIBRARY)
|
|
set_property(TARGET bar_static_private APPEND PROPERTY INTERFACE_LINK_LIBRARIES $<LINK_ONLY:zot_static_private>)
|
|
|
|
add_executable(InterfaceLinkLibraries main_vs6_4.cpp)
|
|
set_property(TARGET InterfaceLinkLibraries APPEND PROPERTY LINK_LIBRARIES bar_static_private)
|
|
|
|
add_library(foo_link_only STATIC foo_link_only.c)
|
|
target_compile_definitions(foo_link_only PUBLIC FOO_LINK_ONLY)
|
|
add_executable(use_foo_link_only_CMP0131_OLD use_foo_link_only.c)
|
|
target_link_libraries(use_foo_link_only_CMP0131_OLD PRIVATE "$<LINK_ONLY:foo_link_only>")
|
|
target_compile_definitions(use_foo_link_only_CMP0131_OLD PRIVATE EXPECT_FOO_LINK_ONLY)
|
|
cmake_policy(SET CMP0131 NEW)
|
|
add_executable(use_foo_link_only_CMP0131_NEW use_foo_link_only.c)
|
|
target_link_libraries(use_foo_link_only_CMP0131_NEW PRIVATE "$<LINK_ONLY:foo_link_only>")
|