summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-04-22 11:50:53 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-04-22 11:51:01 (GMT)
commitd0e37018616d43defbc16c752ca9b2be72261fb6 (patch)
treedf9dcdb44073a0566f7b8e573b985613a2033799 /Tests
parent246fdcc049caf19cc85f3ed7a6c20940c6c3cb00 (diff)
parent1baf122cd41d6500139649661052236b8e684565 (diff)
downloadCMake-d0e37018616d43defbc16c752ca9b2be72261fb6.zip
CMake-d0e37018616d43defbc16c752ca9b2be72261fb6.tar.gz
CMake-d0e37018616d43defbc16c752ca9b2be72261fb6.tar.bz2
Merge topic 'msvc-warning-flags'
1baf122cd4 MSVC: Do not add /W3 to CMAKE_<LANG>_FLAGS by default Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3250
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/MSVCWarningFlags/CMP0092-NEW.cmake2
-rw-r--r--Tests/RunCMake/MSVCWarningFlags/CMP0092-OLD.cmake2
-rw-r--r--Tests/RunCMake/MSVCWarningFlags/CMP0092-WARN.cmake2
-rw-r--r--Tests/RunCMake/MSVCWarningFlags/CMP0092-common.cmake12
-rw-r--r--Tests/RunCMake/MSVCWarningFlags/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/MSVCWarningFlags/RunCMakeTest.cmake5
7 files changed, 27 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index a8dcb4b..4973e55 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -197,6 +197,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "^(Cray|PGI|XL|XLClang)$")
endif()
if(MSVC)
add_RunCMake_test(MSVCRuntimeLibrary)
+ add_RunCMake_test(MSVCWarningFlags)
endif()
add_RunCMake_test(ObjectLibrary)
add_RunCMake_test(ParseImplicitIncludeInfo)
diff --git a/Tests/RunCMake/MSVCWarningFlags/CMP0092-NEW.cmake b/Tests/RunCMake/MSVCWarningFlags/CMP0092-NEW.cmake
new file mode 100644
index 0000000..15c52d2
--- /dev/null
+++ b/Tests/RunCMake/MSVCWarningFlags/CMP0092-NEW.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0092 NEW)
+include(CMP0092-common.cmake)
diff --git a/Tests/RunCMake/MSVCWarningFlags/CMP0092-OLD.cmake b/Tests/RunCMake/MSVCWarningFlags/CMP0092-OLD.cmake
new file mode 100644
index 0000000..ea75445
--- /dev/null
+++ b/Tests/RunCMake/MSVCWarningFlags/CMP0092-OLD.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0092 OLD)
+include(CMP0092-common.cmake)
diff --git a/Tests/RunCMake/MSVCWarningFlags/CMP0092-WARN.cmake b/Tests/RunCMake/MSVCWarningFlags/CMP0092-WARN.cmake
new file mode 100644
index 0000000..45e183f
--- /dev/null
+++ b/Tests/RunCMake/MSVCWarningFlags/CMP0092-WARN.cmake
@@ -0,0 +1,2 @@
+
+include(CMP0092-common.cmake)
diff --git a/Tests/RunCMake/MSVCWarningFlags/CMP0092-common.cmake b/Tests/RunCMake/MSVCWarningFlags/CMP0092-common.cmake
new file mode 100644
index 0000000..87d7f67
--- /dev/null
+++ b/Tests/RunCMake/MSVCWarningFlags/CMP0092-common.cmake
@@ -0,0 +1,12 @@
+enable_language(C)
+
+cmake_policy(GET CMP0092 cmp0092)
+if(cmp0092 STREQUAL "NEW")
+ if("${CMAKE_C_FLAGS}" MATCHES "([/-]W[0-9])")
+ message(SEND_ERROR "CMAKE_C_FLAGS has '${CMAKE_MATCH_1}' under NEW behavior")
+ endif()
+else()
+ if(NOT " ${CMAKE_C_FLAGS} " MATCHES " /W3 ")
+ message(SEND_ERROR "CMAKE_C_FLAGS does not have '/W3' under OLD behavior")
+ endif()
+endif()
diff --git a/Tests/RunCMake/MSVCWarningFlags/CMakeLists.txt b/Tests/RunCMake/MSVCWarningFlags/CMakeLists.txt
new file mode 100644
index 0000000..3e470a2
--- /dev/null
+++ b/Tests/RunCMake/MSVCWarningFlags/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.14)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/MSVCWarningFlags/RunCMakeTest.cmake b/Tests/RunCMake/MSVCWarningFlags/RunCMakeTest.cmake
new file mode 100644
index 0000000..7ce448d
--- /dev/null
+++ b/Tests/RunCMake/MSVCWarningFlags/RunCMakeTest.cmake
@@ -0,0 +1,5 @@
+include(RunCMake)
+
+run_cmake(CMP0092-WARN)
+run_cmake(CMP0092-OLD)
+run_cmake(CMP0092-NEW)