summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CompileFeatures/CMakeLists.txt8
-rw-r--r--Tests/Complex/Executable/CMakeLists.txt2
-rw-r--r--Tests/ComplexOneConfig/Executable/CMakeLists.txt2
-rw-r--r--Tests/ExportImport/Import/A/CMakeLists.txt30
-rw-r--r--Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt8
-rw-r--r--Tests/IncludeDirectories/SystemIncludeDirectories/config_specific/config_iface.h14
-rw-r--r--Tests/IncludeDirectories/SystemIncludeDirectories/consumer.cpp2
-rw-r--r--Tests/RunCMake/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/try_compile/BadLinkLibraries-stderr.txt4
-rw-r--r--Tests/RunCMake/try_run/BadLinkLibraries-result.txt1
-rw-r--r--Tests/RunCMake/try_run/BadLinkLibraries-stderr.txt5
-rw-r--r--Tests/RunCMake/try_run/BadLinkLibraries.cmake4
-rw-r--r--Tests/RunCMake/try_run/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/try_run/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/try_run/src.c1
15 files changed, 83 insertions, 5 deletions
diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt
index ef37dcb..aacf4c1 100644
--- a/Tests/CompileFeatures/CMakeLists.txt
+++ b/Tests/CompileFeatures/CMakeLists.txt
@@ -63,6 +63,14 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL SunPro)
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
+ AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.5)
+ # The cxx_raw_string_literals feature happens to work in some distributions
+ # of GNU 4.4, but it is first documented as available with GNU 4.5.
+ list(REMOVE_ITEM CXX_non_features
+ cxx_raw_string_literals
+ )
+endif()
+if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6)
# The cxx_constexpr feature happens to work (for *this* testcase) with
# GNU 4.5, but it is first documented as available with GNU 4.6.
diff --git a/Tests/Complex/Executable/CMakeLists.txt b/Tests/Complex/Executable/CMakeLists.txt
index 508221c..a1f8e68 100644
--- a/Tests/Complex/Executable/CMakeLists.txt
+++ b/Tests/Complex/Executable/CMakeLists.txt
@@ -21,7 +21,7 @@ if(TARGET NotATarget)
message(FATAL_ERROR "if(TARGET NotATarget) returned true!")
endif()
- # Use LINK_LIBRARIES instead of TARGET_LINK_LIBRARIES to
+# Use LINK_LIBRARIES instead of TARGET_LINK_LIBRARIES to
set(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared;CMakeTestCLibraryShared)
link_libraries(${COMPLEX_LIBS})
diff --git a/Tests/ComplexOneConfig/Executable/CMakeLists.txt b/Tests/ComplexOneConfig/Executable/CMakeLists.txt
index e910f20..b2307b2 100644
--- a/Tests/ComplexOneConfig/Executable/CMakeLists.txt
+++ b/Tests/ComplexOneConfig/Executable/CMakeLists.txt
@@ -21,7 +21,7 @@ if(TARGET NotATarget)
message(FATAL_ERROR "if(TARGET NotATarget) returned true!")
endif()
- # Use LINK_LIBRARIES instead of TARGET_LINK_LIBRARIES to
+# Use LINK_LIBRARIES instead of TARGET_LINK_LIBRARIES to
set(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared;CMakeTestCLibraryShared)
link_libraries(${COMPLEX_LIBS})
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()
diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt
index abe9f74..0215e93 100644
--- a/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt
+++ b/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt
@@ -14,8 +14,14 @@ target_include_directories(upstream SYSTEM PUBLIC
$<TARGET_PROPERTY:systemlib,INTERFACE_INCLUDE_DIRECTORIES>
)
+add_library(config_specific INTERFACE)
+set(testConfig ${CMAKE_BUILD_TYPE})
+target_include_directories(config_specific SYSTEM INTERFACE
+ "$<$<CONFIG:${testConfig}>:${CMAKE_CURRENT_SOURCE_DIR}/config_specific>"
+)
+
add_library(consumer consumer.cpp)
-target_link_libraries(consumer upstream)
+target_link_libraries(consumer upstream config_specific)
target_compile_options(consumer PRIVATE -Werror=unused-variable)
add_library(iface IMPORTED INTERFACE)
diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/config_specific/config_iface.h b/Tests/IncludeDirectories/SystemIncludeDirectories/config_specific/config_iface.h
new file mode 100644
index 0000000..05d3604
--- /dev/null
+++ b/Tests/IncludeDirectories/SystemIncludeDirectories/config_specific/config_iface.h
@@ -0,0 +1,14 @@
+
+#ifndef CONFIG_IFACE_H
+#define CONFIG_IFACE_H
+
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+int configUnusedFunc()
+{
+ int unused;
+ return 0;
+}
+
+#endif
diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/consumer.cpp b/Tests/IncludeDirectories/SystemIncludeDirectories/consumer.cpp
index 197dae8..be18ebf 100644
--- a/Tests/IncludeDirectories/SystemIncludeDirectories/consumer.cpp
+++ b/Tests/IncludeDirectories/SystemIncludeDirectories/consumer.cpp
@@ -1,6 +1,8 @@
#include "upstream.h"
+#include "config_iface.h"
+
int consumer()
{
return upstream();
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 12c1f47..d1457a7 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -133,6 +133,7 @@ add_RunCMake_test(project)
add_RunCMake_test(return)
add_RunCMake_test(string)
add_RunCMake_test(try_compile)
+add_RunCMake_test(try_run)
add_RunCMake_test(set)
add_RunCMake_test(variable_watch)
add_RunCMake_test(CMP0004)
diff --git a/Tests/RunCMake/try_compile/BadLinkLibraries-stderr.txt b/Tests/RunCMake/try_compile/BadLinkLibraries-stderr.txt
index eceffec..652bcfc 100644
--- a/Tests/RunCMake/try_compile/BadLinkLibraries-stderr.txt
+++ b/Tests/RunCMake/try_compile/BadLinkLibraries-stderr.txt
@@ -1,5 +1,5 @@
CMake Error at BadLinkLibraries.cmake:2 \(try_compile\):
- Only libraries may be used as try_compile IMPORTED LINK_LIBRARIES. Got
- not_a_library of type UTILITY.
+ Only libraries may be used as try_compile or try_run IMPORTED
+ LINK_LIBRARIES. Got not_a_library of type UTILITY.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_run/BadLinkLibraries-result.txt b/Tests/RunCMake/try_run/BadLinkLibraries-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/try_run/BadLinkLibraries-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_run/BadLinkLibraries-stderr.txt b/Tests/RunCMake/try_run/BadLinkLibraries-stderr.txt
new file mode 100644
index 0000000..dcd1bfc
--- /dev/null
+++ b/Tests/RunCMake/try_run/BadLinkLibraries-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at BadLinkLibraries.cmake:2 \(try_run\):
+ Only libraries may be used as try_compile or try_run IMPORTED
+ LINK_LIBRARIES. Got not_a_library of type UTILITY.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_run/BadLinkLibraries.cmake b/Tests/RunCMake/try_run/BadLinkLibraries.cmake
new file mode 100644
index 0000000..a124bf6
--- /dev/null
+++ b/Tests/RunCMake/try_run/BadLinkLibraries.cmake
@@ -0,0 +1,4 @@
+add_custom_target(not_a_library)
+try_run(RUN_RESULT COMPILE_RESULT
+ ${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+ LINK_LIBRARIES not_a_library)
diff --git a/Tests/RunCMake/try_run/CMakeLists.txt b/Tests/RunCMake/try_run/CMakeLists.txt
new file mode 100644
index 0000000..e034780
--- /dev/null
+++ b/Tests/RunCMake/try_run/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8.0)
+project(${RunCMake_TEST} C)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/try_run/RunCMakeTest.cmake b/Tests/RunCMake/try_run/RunCMakeTest.cmake
new file mode 100644
index 0000000..1ec9a55
--- /dev/null
+++ b/Tests/RunCMake/try_run/RunCMakeTest.cmake
@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake(BadLinkLibraries)
diff --git a/Tests/RunCMake/try_run/src.c b/Tests/RunCMake/try_run/src.c
new file mode 100644
index 0000000..78f2de1
--- /dev/null
+++ b/Tests/RunCMake/try_run/src.c
@@ -0,0 +1 @@
+int main(void) { return 0; }