mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-05 13:50:10 -05:00
target_link_options: Add test to verify static library behavior
Issue: #18251
This commit is contained in:
committed by
Brad King
parent
24f226e2d3
commit
9561d42f95
@@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
if (actual_stdout MATCHES "BADFLAG_RELEASE")
|
||||||
|
set (RunCMake_TEST_FAILED "Found 'BADFLAG_RELEASE' which was not expected.")
|
||||||
|
endif()
|
||||||
|
if (actual_stdout MATCHES "SHELL:")
|
||||||
|
string (APPEND RunCMake_TEST_FAILED "\nFound unexpected prefix 'SHELL:'.")
|
||||||
|
endif()
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
0
|
||||||
@@ -22,6 +22,13 @@ add_executable(LinkOptions_consumer LinkOptionsExe.c)
|
|||||||
target_link_libraries(LinkOptions_consumer PRIVATE LinkOptions_producer)
|
target_link_libraries(LinkOptions_consumer PRIVATE LinkOptions_producer)
|
||||||
|
|
||||||
|
|
||||||
|
# static library with generator expression
|
||||||
|
add_library(LinkOptions_static STATIC LinkOptionsLib.c)
|
||||||
|
target_link_options(LinkOptions_static PRIVATE $<$<CONFIG:Release>:${pre}BADFLAG_RELEASE${obj}>
|
||||||
|
"SHELL:" # produces no options
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# shared library with generator expression
|
# shared library with generator expression
|
||||||
add_library(LinkOptions_shared SHARED LinkOptionsLib.c)
|
add_library(LinkOptions_shared SHARED LinkOptionsLib.c)
|
||||||
target_link_options(LinkOptions_shared PRIVATE $<$<CONFIG:Release>:${pre}BADFLAG_RELEASE${obj}>
|
target_link_options(LinkOptions_shared PRIVATE $<$<CONFIG:Release>:${pre}BADFLAG_RELEASE${obj}>
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel")
|
|||||||
|
|
||||||
run_cmake_target(LINK_OPTIONS basic LinkOptions)
|
run_cmake_target(LINK_OPTIONS basic LinkOptions)
|
||||||
run_cmake_target(LINK_OPTIONS interface LinkOptions_consumer)
|
run_cmake_target(LINK_OPTIONS interface LinkOptions_consumer)
|
||||||
|
run_cmake_target(LINK_OPTIONS static LinkOptions_static --config Release)
|
||||||
run_cmake_target(LINK_OPTIONS shared LinkOptions_shared --config Release)
|
run_cmake_target(LINK_OPTIONS shared LinkOptions_shared --config Release)
|
||||||
run_cmake_target(LINK_OPTIONS mod LinkOptions_mod --config Release)
|
run_cmake_target(LINK_OPTIONS mod LinkOptions_mod --config Release)
|
||||||
run_cmake_target(LINK_OPTIONS exe LinkOptions_exe --config Release)
|
run_cmake_target(LINK_OPTIONS exe LinkOptions_exe --config Release)
|
||||||
|
|||||||
Reference in New Issue
Block a user