From 18d7f8fbfbf9a03ff0742c26a349a2030cecb9d5 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 2 Sep 2015 16:09:22 -0400 Subject: Tests: Move LINK_SEARCH_{START,END}_STATIC case to dedicated test The test case added to RunCMake.set_property by commit 675ef165 (Allow LINK_SEARCH_{START,END}_STATIC props to have default values, 2015-08-07) is not a test of the set_property command and so belongs in its own test case. Create a new RunCMake.LinkStatic test to cover cases related to static linking. While at it, simplify the LINK_SEARCH_STATIC test case to enable only C. --- Tests/RunCMake/CMakeLists.txt | 1 + Tests/RunCMake/LinkStatic/CMakeLists.txt | 3 + Tests/RunCMake/LinkStatic/LINK_SEARCH_STATIC.cmake | 73 ++++++++++++++++++++++ Tests/RunCMake/LinkStatic/LinkStatic.c | 5 ++ Tests/RunCMake/LinkStatic/RunCMakeTest.cmake | 3 + .../RunCMake/set_property/LINK_SEARCH_STATIC.cmake | 73 ---------------------- Tests/RunCMake/set_property/LinkStatic.c | 5 -- Tests/RunCMake/set_property/RunCMakeTest.cmake | 1 - 8 files changed, 85 insertions(+), 79 deletions(-) create mode 100644 Tests/RunCMake/LinkStatic/CMakeLists.txt create mode 100644 Tests/RunCMake/LinkStatic/LINK_SEARCH_STATIC.cmake create mode 100644 Tests/RunCMake/LinkStatic/LinkStatic.c create mode 100644 Tests/RunCMake/LinkStatic/RunCMakeTest.cmake delete mode 100644 Tests/RunCMake/set_property/LINK_SEARCH_STATIC.cmake delete mode 100644 Tests/RunCMake/set_property/LinkStatic.c diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index c274d8f..8728ea6 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -139,6 +139,7 @@ add_RunCMake_test(GeneratorToolset) add_RunCMake_test(GNUInstallDirs) add_RunCMake_test(TargetPropertyGeneratorExpressions) add_RunCMake_test(Languages) +add_RunCMake_test(LinkStatic) add_RunCMake_test(ObjectLibrary) add_RunCMake_test(Swift) add_RunCMake_test(TargetObjects) diff --git a/Tests/RunCMake/LinkStatic/CMakeLists.txt b/Tests/RunCMake/LinkStatic/CMakeLists.txt new file mode 100644 index 0000000..74b3ff8 --- /dev/null +++ b/Tests/RunCMake/LinkStatic/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.3) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/LinkStatic/LINK_SEARCH_STATIC.cmake b/Tests/RunCMake/LinkStatic/LINK_SEARCH_STATIC.cmake new file mode 100644 index 0000000..6db5c85 --- /dev/null +++ b/Tests/RunCMake/LinkStatic/LINK_SEARCH_STATIC.cmake @@ -0,0 +1,73 @@ +enable_language(C) + +set(CMAKE_LINK_SEARCH_START_STATIC ON) +add_executable(LinkSearchStartStaticInit1 LinkStatic.c) +get_target_property(LSSS LinkSearchStartStaticInit1 + LINK_SEARCH_START_STATIC) +if(NOT LSSS) + message(FATAL_ERROR "Failed to correctly initialize LINK_SEARCH_START_STATIC") +endif() +unset(CMAKE_LINK_SEARCH_START_STATIC) + +add_executable(LinkSearchStartStaticSet1 LinkStatic.c) +set_target_properties(LinkSearchStartStaticSet1 PROPERTIES + LINK_SEARCH_START_STATIC ON) +get_target_property(LSSS LinkSearchStartStaticSet1 + LINK_SEARCH_START_STATIC) +if(NOT LSSS) + message(FATAL_ERROR "Failed to correctly set LINK_SEARCH_START_STATIC") +endif() + +set(CMAKE_LINK_SEARCH_START_STATIC OFF) +add_executable(LinkSearchStartStaticInit2 LinkStatic.c) +get_target_property(LSSS LinkSearchStartStaticInit2 + LINK_SEARCH_START_STATIC) +if(LSSS) + message(FATAL_ERROR "Failed to correctly initialize LINK_SEARCH_START_STATIC") +endif() +unset(CMAKE_LINK_SEARCH_START_STATIC) + +add_executable(LinkSearchStartStaticSet2 LinkStatic.c) +set_target_properties(LinkSearchStartStaticSet2 PROPERTIES + LINK_SEARCH_START_STATIC OFF) +get_target_property(LSSS LinkSearchStartStaticSet2 + LINK_SEARCH_START_STATIC) +if(LSSS) + message(FATAL_ERROR "Failed to correctly set LINK_SEARCH_START_STATIC") +endif() + +set(CMAKE_LINK_SEARCH_END_STATIC ON) +add_executable(LinkSearchEndStaticInit1 LinkStatic.c) +get_target_property(LSES LinkSearchEndStaticInit1 + LINK_SEARCH_END_STATIC) +if(NOT LSES) + message(FATAL_ERROR "Failed to correctly initialize LINK_SEARCH_END_STATIC") +endif() +unset(CMAKE_LINK_SEARCH_END_STATIC) + +add_executable(LinkSearchEndStaticSet1 LinkStatic.c) +set_target_properties(LinkSearchEndStaticSet1 PROPERTIES + LINK_SEARCH_END_STATIC ON) +get_target_property(LSSS LinkSearchEndStaticSet1 + LINK_SEARCH_END_STATIC) +if(NOT LSSS) + message(FATAL_ERROR "Failed to correctly set LINK_SEARCH_END_STATIC") +endif() + +set(CMAKE_LINK_SEARCH_END_STATIC OFF) +add_executable(LinkSearchEndStaticInit2 LinkStatic.c) +get_target_property(LSES LinkSearchEndStaticInit2 + LINK_SEARCH_END_STATIC) +if(LSES) + message(FATAL_ERROR "Failed to correctly initialize LINK_SEARCH_END_STATIC") +endif() +unset(CMAKE_LINK_SEARCH_END_STATIC) + +add_executable(LinkSearchEndStaticSet2 LinkStatic.c) +set_target_properties(LinkSearchEndStaticSet2 PROPERTIES + LINK_SEARCH_END_STATIC ON) +get_target_property(LSSS LinkSearchEndStaticSet2 + LINK_SEARCH_END_STATIC) +if(NOT LSSS) + message(FATAL_ERROR "Failed to correctly set LINK_SEARCH_END_STATIC") +endif() diff --git a/Tests/RunCMake/LinkStatic/LinkStatic.c b/Tests/RunCMake/LinkStatic/LinkStatic.c new file mode 100644 index 0000000..3600977 --- /dev/null +++ b/Tests/RunCMake/LinkStatic/LinkStatic.c @@ -0,0 +1,5 @@ +#include +int main(void) +{ + return (int)sin(0); +} diff --git a/Tests/RunCMake/LinkStatic/RunCMakeTest.cmake b/Tests/RunCMake/LinkStatic/RunCMakeTest.cmake new file mode 100644 index 0000000..0d29492 --- /dev/null +++ b/Tests/RunCMake/LinkStatic/RunCMakeTest.cmake @@ -0,0 +1,3 @@ +include(RunCMake) + +run_cmake(LINK_SEARCH_STATIC) diff --git a/Tests/RunCMake/set_property/LINK_SEARCH_STATIC.cmake b/Tests/RunCMake/set_property/LINK_SEARCH_STATIC.cmake deleted file mode 100644 index 70d2fee..0000000 --- a/Tests/RunCMake/set_property/LINK_SEARCH_STATIC.cmake +++ /dev/null @@ -1,73 +0,0 @@ -project(LinkSearchStatic) - -set(CMAKE_LINK_SEARCH_START_STATIC ON) -add_executable(LinkSearchStartStaticInit1 LinkStatic.c) -get_target_property(LSSS LinkSearchStartStaticInit1 - LINK_SEARCH_START_STATIC) -if(NOT LSSS) - message(FATAL_ERROR "Failed to correctly initialize LINK_SEARCH_START_STATIC") -endif() -unset(CMAKE_LINK_SEARCH_START_STATIC) - -add_executable(LinkSearchStartStaticSet1 LinkStatic.c) -set_target_properties(LinkSearchStartStaticSet1 PROPERTIES - LINK_SEARCH_START_STATIC ON) -get_target_property(LSSS LinkSearchStartStaticSet1 - LINK_SEARCH_START_STATIC) -if(NOT LSSS) - message(FATAL_ERROR "Failed to correctly set LINK_SEARCH_START_STATIC") -endif() - -set(CMAKE_LINK_SEARCH_START_STATIC OFF) -add_executable(LinkSearchStartStaticInit2 LinkStatic.c) -get_target_property(LSSS LinkSearchStartStaticInit2 - LINK_SEARCH_START_STATIC) -if(LSSS) - message(FATAL_ERROR "Failed to correctly initialize LINK_SEARCH_START_STATIC") -endif() -unset(CMAKE_LINK_SEARCH_START_STATIC) - -add_executable(LinkSearchStartStaticSet2 LinkStatic.c) -set_target_properties(LinkSearchStartStaticSet2 PROPERTIES - LINK_SEARCH_START_STATIC OFF) -get_target_property(LSSS LinkSearchStartStaticSet2 - LINK_SEARCH_START_STATIC) -if(LSSS) - message(FATAL_ERROR "Failed to correctly set LINK_SEARCH_START_STATIC") -endif() - -set(CMAKE_LINK_SEARCH_END_STATIC ON) -add_executable(LinkSearchEndStaticInit1 LinkStatic.c) -get_target_property(LSES LinkSearchEndStaticInit1 - LINK_SEARCH_END_STATIC) -if(NOT LSES) - message(FATAL_ERROR "Failed to correctly initialize LINK_SEARCH_END_STATIC") -endif() -unset(CMAKE_LINK_SEARCH_END_STATIC) - -add_executable(LinkSearchEndStaticSet1 LinkStatic.c) -set_target_properties(LinkSearchEndStaticSet1 PROPERTIES - LINK_SEARCH_END_STATIC ON) -get_target_property(LSSS LinkSearchEndStaticSet1 - LINK_SEARCH_END_STATIC) -if(NOT LSSS) - message(FATAL_ERROR "Failed to correctly set LINK_SEARCH_END_STATIC") -endif() - -set(CMAKE_LINK_SEARCH_END_STATIC OFF) -add_executable(LinkSearchEndStaticInit2 LinkStatic.c) -get_target_property(LSES LinkSearchEndStaticInit2 - LINK_SEARCH_END_STATIC) -if(LSES) - message(FATAL_ERROR "Failed to correctly initialize LINK_SEARCH_END_STATIC") -endif() -unset(CMAKE_LINK_SEARCH_END_STATIC) - -add_executable(LinkSearchEndStaticSet2 LinkStatic.c) -set_target_properties(LinkSearchEndStaticSet2 PROPERTIES - LINK_SEARCH_END_STATIC ON) -get_target_property(LSSS LinkSearchEndStaticSet2 - LINK_SEARCH_END_STATIC) -if(NOT LSSS) - message(FATAL_ERROR "Failed to correctly set LINK_SEARCH_END_STATIC") -endif() diff --git a/Tests/RunCMake/set_property/LinkStatic.c b/Tests/RunCMake/set_property/LinkStatic.c deleted file mode 100644 index 3600977..0000000 --- a/Tests/RunCMake/set_property/LinkStatic.c +++ /dev/null @@ -1,5 +0,0 @@ -#include -int main(void) -{ - return (int)sin(0); -} diff --git a/Tests/RunCMake/set_property/RunCMakeTest.cmake b/Tests/RunCMake/set_property/RunCMakeTest.cmake index ada8804..54e63f7 100644 --- a/Tests/RunCMake/set_property/RunCMakeTest.cmake +++ b/Tests/RunCMake/set_property/RunCMakeTest.cmake @@ -1,4 +1,3 @@ include(RunCMake) run_cmake(LINK_LIBRARIES) -run_cmake(LINK_SEARCH_STATIC) -- cgit v0.12