summaryrefslogtreecommitdiffstats
path: root/Tests/GhsMulti/GhsMultiLinkTest
diff options
context:
space:
mode:
authorFred Baksik <frodak17@gmail.com>2019-01-09 04:52:12 (GMT)
committerFred Baksik <frodak17@gmail.com>2019-01-16 15:42:08 (GMT)
commit21ab58d3f8782e80145f14eb6e72926c9d17afc6 (patch)
tree04b73d0d54cc854bedc8641aa5b7f73677362088 /Tests/GhsMulti/GhsMultiLinkTest
parent72e0c115b771fe9e3f4b5a5b6bd3bcdade77a7cb (diff)
downloadCMake-21ab58d3f8782e80145f14eb6e72926c9d17afc6.zip
CMake-21ab58d3f8782e80145f14eb6e72926c9d17afc6.tar.gz
CMake-21ab58d3f8782e80145f14eb6e72926c9d17afc6.tar.bz2
GHS: Update test suite
-- Allow for testing default toolset settings If CMake_TEST_GreenHillsMULTI_config is not defined then just run the GHS tests using defaults. -- Handle paths that contain spaces -- Update test suite to use "-non_shared" linker option Fixes linking issue if GHS is not shipped with shared libraries -- Other minor cleanup
Diffstat (limited to 'Tests/GhsMulti/GhsMultiLinkTest')
-rw-r--r--Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt16
-rw-r--r--Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt.in38
2 files changed, 31 insertions, 23 deletions
diff --git a/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt b/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt
index dfb72ce..da80b51 100644
--- a/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt
+++ b/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt
@@ -37,7 +37,7 @@ if (RUN_TEST STREQUAL "NO_FLAGS")
endif()
else()
unset(fileName CACHE)
- find_file (fileName exe1.gpj
+ find_file(fileName exe1.gpj
${CMAKE_CURRENT_BINARY_DIR}/link_build
${CMAKE_CURRENT_BINARY_DIR}/link_build/exe1
)
@@ -50,12 +50,12 @@ else()
-lcsl1 csl2
-clinkexe1 -clinkexe2
-special-lib2-public-link)
- foreach( opt IN LISTS expected_flags )
+ foreach(opt IN LISTS expected_flags)
string(FIND "${fileText}" "${opt}" opt_found)
if ( opt_found EQUAL -1 )
message(SEND_ERROR "Could not find: ${opt}")
endif()
- endforeach(opt)
+ endforeach()
unset(fileName CACHE)
find_file (fileName lib1.gpj
@@ -67,12 +67,12 @@ else()
set(expected_flags
-clinkexeA1 -clinkexeA2
-static-lib-flags1 -static-lib-flags2)
- foreach( opt IN LISTS expected_flags )
+ foreach(opt IN LISTS expected_flags)
string(FIND "${fileText}" "${opt}" opt_found)
- if ( opt_found EQUAL -1 )
+ if (opt_found EQUAL -1)
message(SEND_ERROR "Could not find: ${opt}")
endif()
- endforeach(opt)
+ endforeach()
unset(fileName CACHE)
find_file (fileName lib2.gpj
@@ -83,10 +83,10 @@ else()
file(STRINGS ${fileName} fileText)
set(expected_flags
-clinkexeA1 -clinkexeA2)
- foreach( opt IN LISTS expected_flags )
+ foreach(opt IN LISTS expected_flags)
string(FIND "${fileText}" "${opt}" opt_found)
if ( opt_found EQUAL -1 )
message(SEND_ERROR "Could not find: ${opt}")
endif()
- endforeach(opt)
+ endforeach()
endif()
diff --git a/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt.in b/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt.in
index 4cf86a2..58c2115 100644
--- a/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt.in
+++ b/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt.in
@@ -5,31 +5,39 @@ cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
project(test C)
-if( RUN_TEST STREQUAL "CHECK_FLAGS" )
-add_link_options(-add-link-options1 -add-link-options2)
-link_directories(link_directories_used1 link_directories_used2 "c:/absolute")
-link_libraries(link_libraries_used1 link_libraries_used2 )
-set( CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lcsl1 csl2" )
-set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -clinkexe1 -clinkexe2")
+if(CMAKE_C_COMPILER_ID STREQUAL "GHS")
+ add_link_options("-non_shared")
+endif()
+
+if(RUN_TEST STREQUAL "CHECK_FLAGS")
+ add_link_options(-add-link-options1 -add-link-options2)
+ link_directories(link_directories_used1 link_directories_used2 "c:/absolute")
+ link_libraries(link_libraries_used1 link_libraries_used2 )
+ set( CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lcsl1 csl2" )
+ set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -clinkexe1 -clinkexe2")
endif()
add_executable(exe1 exe1.c)
target_link_libraries(exe1 lib1)
-if( RUN_TEST STREQUAL "CHECK_FLAGS" )
-set_property( TARGET exe1 APPEND_STRING PROPERTY LINK_FLAGS "--link-flag-prop1 --link-flag-prop2")
-set_property( TARGET exe1 APPEND PROPERTY LINK_OPTIONS --link-opt-prop1 --link-opt-prop2)
+
+if(RUN_TEST STREQUAL "CHECK_FLAGS")
+ set_property(TARGET exe1 APPEND_STRING PROPERTY LINK_FLAGS "--link-flag-prop1 --link-flag-prop2")
+ set_property(TARGET exe1 APPEND PROPERTY LINK_OPTIONS --link-opt-prop1 --link-opt-prop2)
endif()
-if( RUN_TEST STREQUAL "CHECK_FLAGS" )
-set( CMAKE_STATIC_LINKER_FLAGS ${CMAKE_STATIC_LINKER_FLAGS} "-clinkexeA1 -clinkexeA2")
+if(RUN_TEST STREQUAL "CHECK_FLAGS")
+ set(CMAKE_STATIC_LINKER_FLAGS ${CMAKE_STATIC_LINKER_FLAGS} "-clinkexeA1 -clinkexeA2")
endif()
+
add_library(lib1 STATIC func2.c func3.c func4.c)
target_link_libraries(lib1 lib2)
-if( RUN_TEST STREQUAL "CHECK_FLAGS" )
-set_property( TARGET lib1 APPEND_STRING PROPERTY STATIC_LIBRARY_FLAGS "-static-lib-flags1 -static-lib-flags2")
+
+if(RUN_TEST STREQUAL "CHECK_FLAGS")
+ set_property(TARGET lib1 APPEND_STRING PROPERTY STATIC_LIBRARY_FLAGS "-static-lib-flags1 -static-lib-flags2")
endif()
add_library(lib2 STATIC func5.c func6.c func7.c)
-if( RUN_TEST STREQUAL "CHECK_FLAGS" )
-target_link_options(lib2 PUBLIC -special-lib2-public-link)
+
+if(RUN_TEST STREQUAL "CHECK_FLAGS")
+ target_link_options(lib2 PUBLIC -special-lib2-public-link)
endif()