Tests/LinkStatic: Standardize RunCMake use where possible

Test cases which only check for the presence of an expression need not
use a custom check script. Prepare for a future commit which adds more
such cases so that this test consistently only uses check scripts where
needed.

Also apply more explicit checking for success or failure for each case.
This commit is contained in:
Tyler Yankee
2026-01-21 07:44:31 -05:00
committed by Brad King
parent 48e08cb757
commit d38c268f4d
7 changed files with 6 additions and 11 deletions

View File

@@ -6,6 +6,9 @@ run_cmake(LINK_SEARCH_STATIC)
macro(run_cmake_target test subtest target)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build)
set(RunCMake_TEST_NO_CLEAN 1)
if(RunCMake_GENERATOR STREQUAL "Borland Makefiles")
set(RunCMake_TEST_EXPECT_RESULT .)
endif()
run_cmake_command(${test}-${subtest} ${CMAKE_COMMAND} --build . --target ${target} ${ARGN})
unset(RunCMake_TEST_BINARY_DIR)

View File

@@ -1,4 +0,0 @@
if (NOT actual_stdout MATCHES "BADFLAG")
set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG'.")
endif()

View File

@@ -0,0 +1 @@
.*BADFLAG.*

View File

@@ -1,4 +0,0 @@
if (actual_stdout MATCHES "BADFLAG")
string (APPEND RunCMake_TEST_FAILED "\nFound unexpected flag 'BADFLAG'.")
endif()