summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorMatt McCormick <matt.mccormick@kitware.com>2015-01-23 00:53:16 (GMT)
committerBrad King <brad.king@kitware.com>2015-01-26 15:05:59 (GMT)
commitd0adcccbf4321437f5ecb677c7f88b3e4af484ed (patch)
treecd231cc86be7161059cb4de71e56e3290ceb641c /Tests
parent223c5cb70b30b6a790fd916321f60c86d459e15e (diff)
downloadCMake-d0adcccbf4321437f5ecb677c7f88b3e4af484ed.zip
CMake-d0adcccbf4321437f5ecb677c7f88b3e4af484ed.tar.gz
CMake-d0adcccbf4321437f5ecb677c7f88b3e4af484ed.tar.bz2
try_run: Add tests for LINK_LIBRARIES with mock libraries.
Extend the ExportImport test to try using an imported library with try_run.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/ExportImport/Import/A/CMakeLists.txt30
1 files changed, 30 insertions, 0 deletions
diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt
index 9450c82..358776b 100644
--- a/Tests/ExportImport/Import/A/CMakeLists.txt
+++ b/Tests/ExportImport/Import/A/CMakeLists.txt
@@ -311,6 +311,21 @@ if (((CMAKE_C_COMPILER_ID STREQUAL GNU AND CMAKE_C_COMPILER_VERSION VERSION_GREA
message(SEND_ERROR "EXP_ERROR_VARIABLE try_compile failed, but it was expected to succeed ${OUTPUT}.")
endif()
+ if(NOT CMAKE_CROSSCOMPILING)
+ unset(EXP_RUN_VAR CACHE)
+ unset(EXP_COMPILE_VAR CACHE)
+ try_run(EXP_RUN_VAR EXP_COMPILE_VAR
+ "${CMAKE_CURRENT_SOURCE_DIR}/test_system"
+ "${CMAKE_CURRENT_SOURCE_DIR}/test_system.cpp"
+ COMPILE_DEFINITIONS "-Wunused-variable -Werror=unused-variable"
+ LINK_LIBRARIES exp_systemlib
+ OUTPUT_VARIABLE OUTPUT
+ )
+ if(NOT EXP_COMPILE_VAR)
+ message(SEND_ERROR "try_run compile failed, but it was expected to succeed ${OUTPUT}.")
+ endif()
+ endif()
+
add_executable(test_system_bld test_system.cpp)
target_link_libraries(test_system_bld bld_systemlib)
target_compile_options(test_system_bld PRIVATE -Wunused-variable -Werror=unused-variable)
@@ -326,5 +341,20 @@ if (((CMAKE_C_COMPILER_ID STREQUAL GNU AND CMAKE_C_COMPILER_VERSION VERSION_GREA
if(NOT BLD_ERROR_VARIABLE)
message(SEND_ERROR "BLD_ERROR_VARIABLE try_compile failed, but it was expected to succeed.")
endif()
+
+ if(NOT CMAKE_CROSSCOMPILING)
+ unset(BLD_RUN_VAR CACHE)
+ unset(BLD_COMPILE_VAR CACHE)
+ try_run(BLD_RUN_VAR BLD_COMPILE_VAR
+ "${CMAKE_CURRENT_SOURCE_DIR}/test_system"
+ "${CMAKE_CURRENT_SOURCE_DIR}/test_system.cpp"
+ COMPILE_DEFINITIONS "-Wunused-variable -Werror=unused-variable"
+ LINK_LIBRARIES bld_systemlib
+ OUTPUT_VARIABLE OUTPUT
+ )
+ if(NOT BLD_COMPILE_VAR)
+ message(SEND_ERROR "try_run compile failed, but it was expected to succeed ${OUTPUT}.")
+ endif()
+ endif()
endif()
endif()