summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-12-26 14:59:55 (GMT)
committerStephen Kelly <steveire@gmail.com>2014-01-08 15:41:34 (GMT)
commit6aabb6a62b679f64e278087fc671cd33a35bf871 (patch)
treeabf9f40e80fd8577e3cdda4fcd8a8cfd0b6b2037 /Tests
parent5bb53f6b731228e4592066329e8992987289a986 (diff)
downloadCMake-6aabb6a62b679f64e278087fc671cd33a35bf871.zip
CMake-6aabb6a62b679f64e278087fc671cd33a35bf871.tar.gz
CMake-6aabb6a62b679f64e278087fc671cd33a35bf871.tar.bz2
Genex: Use case-sensitive comparison for COMPILER_ID.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/GeneratorExpression/CMP0044/CMakeLists.txt19
-rw-r--r--Tests/GeneratorExpression/CMP0044/cmp0044-check.cpp26
-rw-r--r--Tests/GeneratorExpression/CMakeLists.txt6
-rw-r--r--Tests/RunCMake/CMP0043/CMakeLists.txt4
-rw-r--r--Tests/RunCMake/GeneratorExpression/CMP0044-WARN-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorExpression/CMP0044-WARN-stderr.txt7
-rw-r--r--Tests/RunCMake/GeneratorExpression/CMP0044-WARN.cmake17
-rw-r--r--Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake1
8 files changed, 81 insertions, 0 deletions
diff --git a/Tests/GeneratorExpression/CMP0044/CMakeLists.txt b/Tests/GeneratorExpression/CMP0044/CMakeLists.txt
new file mode 100644
index 0000000..309a8cc
--- /dev/null
+++ b/Tests/GeneratorExpression/CMP0044/CMakeLists.txt
@@ -0,0 +1,19 @@
+
+string(TOLOWER ${CMAKE_C_COMPILER_ID} lc_test)
+if (lc_test STREQUAL CMAKE_C_COMPILER_ID)
+ string(TOUPPER ${CMAKE_C_COMPILER_ID} lc_test)
+ if (lc_test STREQUAL CMAKE_C_COMPILER_ID)
+ message(SEND_ERROR "Try harder.")
+ endif()
+endif()
+
+if (CMP0044_TYPE)
+ cmake_policy(SET CMP0044 ${CMP0044_TYPE})
+endif()
+
+add_library(cmp0044-check-${CMP0044_TYPE} cmp0044-check.cpp)
+target_compile_definitions(cmp0044-check-${CMP0044_TYPE}
+ PRIVATE
+ Result=$<C_COMPILER_ID:${lc_test}>
+ Type_Is_${CMP0044_TYPE}
+)
diff --git a/Tests/GeneratorExpression/CMP0044/cmp0044-check.cpp b/Tests/GeneratorExpression/CMP0044/cmp0044-check.cpp
new file mode 100644
index 0000000..2356bc4
--- /dev/null
+++ b/Tests/GeneratorExpression/CMP0044/cmp0044-check.cpp
@@ -0,0 +1,26 @@
+
+#ifdef Type_Is_
+# if !Result
+# error Result should be 1 in WARN mode
+# endif
+#endif
+
+#ifdef Type_Is_NEW
+# if Result
+# error Result should be 0 in NEW mode
+# endif
+#endif
+
+#ifdef Type_Is_OLD
+# if !Result
+# error Result should be 1 in OLD mode
+# endif
+#endif
+
+#if !defined(Type_Is_) && !defined(Type_Is_OLD) && !defined(Type_Is_NEW)
+#error No expected definition present
+#endif
+
+void foo(void)
+{
+}
diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt
index 3b85dc3..a0e34ef 100644
--- a/Tests/GeneratorExpression/CMakeLists.txt
+++ b/Tests/GeneratorExpression/CMakeLists.txt
@@ -252,3 +252,9 @@ endforeach()
add_test(echo-old-style echo "\$<CONFIGURATION>")
set_property(TEST echo-old-style PROPERTY
PASS_REGULAR_EXPRESSION "^\\$<CONFIGURATION>\n$")
+
+add_subdirectory(CMP0044 ${CMAKE_BINARY_DIR}/CMP0044-WARN)
+set(CMP0044_TYPE NEW)
+add_subdirectory(CMP0044 ${CMAKE_BINARY_DIR}/CMP0044-NEW)
+set(CMP0044_TYPE OLD)
+add_subdirectory(CMP0044 ${CMAKE_BINARY_DIR}/CMP0044-OLD)
diff --git a/Tests/RunCMake/CMP0043/CMakeLists.txt b/Tests/RunCMake/CMP0043/CMakeLists.txt
index 11ea636..b465c88 100644
--- a/Tests/RunCMake/CMP0043/CMakeLists.txt
+++ b/Tests/RunCMake/CMP0043/CMakeLists.txt
@@ -1,3 +1,7 @@
cmake_minimum_required(VERSION 2.8)
project(${RunCMake_TEST} CXX)
include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE)
+
+if(CMAKE_BUILD_TYPE)
+ # Dummy variable use
+endif()
diff --git a/Tests/RunCMake/GeneratorExpression/CMP0044-WARN-result.txt b/Tests/RunCMake/GeneratorExpression/CMP0044-WARN-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/CMP0044-WARN-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/GeneratorExpression/CMP0044-WARN-stderr.txt b/Tests/RunCMake/GeneratorExpression/CMP0044-WARN-stderr.txt
new file mode 100644
index 0000000..2079c12
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/CMP0044-WARN-stderr.txt
@@ -0,0 +1,7 @@
+CMake Warning \(dev\) at CMP0044-WARN.cmake:13 \(target_compile_definitions\):
+ Policy CMP0044 is not set: Case sensitive <LANG>_COMPILER_ID generator
+ expressions. Run "cmake --help-policy CMP0044" for policy details. Use
+ the cmake_policy command to set the policy and suppress this warning.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/GeneratorExpression/CMP0044-WARN.cmake b/Tests/RunCMake/GeneratorExpression/CMP0044-WARN.cmake
new file mode 100644
index 0000000..d5b85c9
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/CMP0044-WARN.cmake
@@ -0,0 +1,17 @@
+
+project(CMP0044-WARN)
+
+string(TOLOWER ${CMAKE_C_COMPILER_ID} lc_test)
+if (lc_test STREQUAL CMAKE_C_COMPILER_ID)
+ string(TOUPPER ${CMAKE_C_COMPILER_ID} lc_test)
+ if (lc_test STREQUAL CMAKE_C_COMPILER_ID)
+ message(SEND_ERROR "Try harder.")
+ endif()
+endif()
+
+add_library(cmp0044-check empty.c)
+target_compile_definitions(cmp0044-check
+ PRIVATE
+ Result=$<C_COMPILER_ID:${lc_test}>
+ Type_Is_${CMP0044_TYPE}
+)
diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
index 54d5064..f3f99ed 100644
--- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
@@ -9,3 +9,4 @@ run_cmake(BadZero)
run_cmake(BadTargetName)
run_cmake(BadTargetTypeObject)
run_cmake(BadInstallPrefix)
+run_cmake(CMP0044-WARN)