diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2018-09-28 15:30:22 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2018-11-08 13:58:57 (GMT) |
commit | 023188ffb48cc35ebab7cabbafefcd6dd31b750d (patch) | |
tree | 088a0aea32a5e1a514cbb61b6bc5a007ad6a827b /Tests/RunCMake/PositionIndependentCode | |
parent | 17e98e00c449ebdceac980c0ce65c800030605db (diff) | |
download | CMake-023188ffb48cc35ebab7cabbafefcd6dd31b750d.zip CMake-023188ffb48cc35ebab7cabbafefcd6dd31b750d.tar.gz CMake-023188ffb48cc35ebab7cabbafefcd6dd31b750d.tar.bz2 |
INTERFACE_POSITION_INDEPENDENT_CODE: add generator expressions support
Fixes: #16532
Diffstat (limited to 'Tests/RunCMake/PositionIndependentCode')
7 files changed, 28 insertions, 0 deletions
diff --git a/Tests/RunCMake/PositionIndependentCode/Genex1-result.txt b/Tests/RunCMake/PositionIndependentCode/Genex1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/PositionIndependentCode/Genex1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/PositionIndependentCode/Genex1-stderr.txt b/Tests/RunCMake/PositionIndependentCode/Genex1-stderr.txt new file mode 100644 index 0000000..c242a05 --- /dev/null +++ b/Tests/RunCMake/PositionIndependentCode/Genex1-stderr.txt @@ -0,0 +1,3 @@ +CMake Error: Property POSITION_INDEPENDENT_CODE on target "conflict1" does +not match the INTERFACE_POSITION_INDEPENDENT_CODE property requirement +of dependency "genex_pic". diff --git a/Tests/RunCMake/PositionIndependentCode/Genex1.cmake b/Tests/RunCMake/PositionIndependentCode/Genex1.cmake new file mode 100644 index 0000000..a91be3e --- /dev/null +++ b/Tests/RunCMake/PositionIndependentCode/Genex1.cmake @@ -0,0 +1,9 @@ + +add_library(genex_pic UNKNOWN IMPORTED) +# PIC is ON if sibling target is a library, OFF if it is an executable +set_property(TARGET genex_pic PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE $<NOT:$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>>) + + +add_library(conflict1 STATIC main.cpp) +set_property(TARGET conflict1 PROPERTY POSITION_INDEPENDENT_CODE OFF) +target_link_libraries(conflict1 PRIVATE genex_pic) diff --git a/Tests/RunCMake/PositionIndependentCode/Genex2-result.txt b/Tests/RunCMake/PositionIndependentCode/Genex2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/PositionIndependentCode/Genex2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/PositionIndependentCode/Genex2-stderr.txt b/Tests/RunCMake/PositionIndependentCode/Genex2-stderr.txt new file mode 100644 index 0000000..735a926 --- /dev/null +++ b/Tests/RunCMake/PositionIndependentCode/Genex2-stderr.txt @@ -0,0 +1,3 @@ +CMake Error: Property POSITION_INDEPENDENT_CODE on target "conflict2" does +not match the INTERFACE_POSITION_INDEPENDENT_CODE property requirement +of dependency "genex_pic". diff --git a/Tests/RunCMake/PositionIndependentCode/Genex2.cmake b/Tests/RunCMake/PositionIndependentCode/Genex2.cmake new file mode 100644 index 0000000..fb0a5db --- /dev/null +++ b/Tests/RunCMake/PositionIndependentCode/Genex2.cmake @@ -0,0 +1,9 @@ + +add_library(genex_pic UNKNOWN IMPORTED) +# PIC is ON if sibling target is a library, OFF if it is an executable +set_property(TARGET genex_pic PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE $<NOT:$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>>) + + +add_executable(conflict2 main.cpp) +set_property(TARGET conflict2 PROPERTY POSITION_INDEPENDENT_CODE ON) +target_link_libraries(conflict2 PRIVATE genex_pic) diff --git a/Tests/RunCMake/PositionIndependentCode/RunCMakeTest.cmake b/Tests/RunCMake/PositionIndependentCode/RunCMakeTest.cmake index 6a67e3c..20187d3 100644 --- a/Tests/RunCMake/PositionIndependentCode/RunCMakeTest.cmake +++ b/Tests/RunCMake/PositionIndependentCode/RunCMakeTest.cmake @@ -7,3 +7,5 @@ run_cmake(Conflict4) run_cmake(Conflict5) run_cmake(Conflict6) run_cmake(Debug) +run_cmake(Genex1) +run_cmake(Genex2) |