summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2020-10-26 12:13:58 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2020-10-28 19:06:02 (GMT)
commita524bf3aa712a783e24e9307cf8915310fb8613a (patch)
tree15b83ce8d536478f37c5156294f17d7a04fff27e
parent96ea613f169cedc4087b536d95ca6c128b8f4eb6 (diff)
downloadCMake-a524bf3aa712a783e24e9307cf8915310fb8613a.zip
CMake-a524bf3aa712a783e24e9307cf8915310fb8613a.tar.gz
CMake-a524bf3aa712a783e24e9307cf8915310fb8613a.tar.bz2
CheckSourceRuns: do not fail on unrecognized arguments
The old `check_X_source_runs` modules did not verify the arguments, so we cannot start doing it now. Downgrade the hard error introduced in commit 357e2ef429 (CheckSoureRuns: Add a unified way to check if a source runs, 2020-09-14) via !5223 into a noisy warning.
-rw-r--r--Modules/CheckCSourceRuns.cmake2
-rw-r--r--Modules/CheckCXXSourceRuns.cmake2
-rw-r--r--Modules/CheckOBJCSourceRuns.cmake2
-rw-r--r--Modules/CheckOBJCXXSourceRuns.cmake2
-rw-r--r--Modules/Internal/CheckSourceRuns.cmake7
-rw-r--r--Tests/RunCMake/CheckSourceRuns/UnknownArgument-stderr.txt15
-rw-r--r--Tests/RunCMake/CheckSourceRuns/UnknownArgument.cmake4
7 files changed, 31 insertions, 3 deletions
diff --git a/Modules/CheckCSourceRuns.cmake b/Modules/CheckCSourceRuns.cmake
index 258b1a0..a99e47e 100644
--- a/Modules/CheckCSourceRuns.cmake
+++ b/Modules/CheckCSourceRuns.cmake
@@ -68,5 +68,7 @@ include_guard(GLOBAL)
include(Internal/CheckSourceRuns)
macro(CHECK_C_SOURCE_RUNS SOURCE VAR)
+ set(_CheckSourceRuns_old_signature 1)
cmake_check_source_runs(C "${SOURCE}" ${VAR} ${ARGN})
+ unset(_CheckSourceRuns_old_signature)
endmacro()
diff --git a/Modules/CheckCXXSourceRuns.cmake b/Modules/CheckCXXSourceRuns.cmake
index 246c873..c8ff3d7 100644
--- a/Modules/CheckCXXSourceRuns.cmake
+++ b/Modules/CheckCXXSourceRuns.cmake
@@ -68,5 +68,7 @@ include_guard(GLOBAL)
include(Internal/CheckSourceRuns)
macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR)
+ set(_CheckSourceRuns_old_signature 1)
cmake_check_source_runs(CXX "${SOURCE}" ${VAR} ${ARGN})
+ unset(_CheckSourceRuns_old_signature)
endmacro()
diff --git a/Modules/CheckOBJCSourceRuns.cmake b/Modules/CheckOBJCSourceRuns.cmake
index 9894180..dd03309 100644
--- a/Modules/CheckOBJCSourceRuns.cmake
+++ b/Modules/CheckOBJCSourceRuns.cmake
@@ -70,5 +70,7 @@ include_guard(GLOBAL)
include(Internal/CheckSourceRuns)
macro(CHECK_OBJC_SOURCE_RUNS SOURCE VAR)
+ set(_CheckSourceRuns_old_signature 1)
cmake_check_source_runs(OBJC "${SOURCE}" ${VAR} ${ARGN})
+ unset(_CheckSourceRuns_old_signature)
endmacro()
diff --git a/Modules/CheckOBJCXXSourceRuns.cmake b/Modules/CheckOBJCXXSourceRuns.cmake
index 43d514f..05a5e4c 100644
--- a/Modules/CheckOBJCXXSourceRuns.cmake
+++ b/Modules/CheckOBJCXXSourceRuns.cmake
@@ -70,5 +70,7 @@ include_guard(GLOBAL)
include(Internal/CheckSourceRuns)
macro(CHECK_OBJCXX_SOURCE_RUNS SOURCE VAR)
+ set(_CheckSourceRuns_old_signature 1)
cmake_check_source_runs(OBJCXX "${SOURCE}" ${VAR} ${ARGN})
+ unset(_CheckSourceRuns_old_signature)
endmacro()
diff --git a/Modules/Internal/CheckSourceRuns.cmake b/Modules/Internal/CheckSourceRuns.cmake
index c667245..3a4b758 100644
--- a/Modules/Internal/CheckSourceRuns.cmake
+++ b/Modules/Internal/CheckSourceRuns.cmake
@@ -51,7 +51,12 @@ function(CMAKE_CHECK_SOURCE_RUNS _lang _source _var)
set(_SRC_EXT "${arg}")
set(_key "")
else()
- message(FATAL_ERROR "Unknown argument:\n ${arg}\n")
+ set(message_type FATAL_ERROR)
+ if (_CheckSourceRuns_old_signature)
+ set(message_type AUTHOR_WARNING)
+ endif ()
+ message("${message_type}" "Unknown argument:\n ${arg}\n")
+ unset(message_type)
endif()
endforeach()
diff --git a/Tests/RunCMake/CheckSourceRuns/UnknownArgument-stderr.txt b/Tests/RunCMake/CheckSourceRuns/UnknownArgument-stderr.txt
index 9b576b5..6824e72 100644
--- a/Tests/RunCMake/CheckSourceRuns/UnknownArgument-stderr.txt
+++ b/Tests/RunCMake/CheckSourceRuns/UnknownArgument-stderr.txt
@@ -1,4 +1,17 @@
-^CMake Error at [^
+^CMake Warning \(dev\) at [^
+]*/Modules/Internal/CheckSourceRuns.cmake:[0-9]+ \(message\):
+ Unknown argument:
+
+ BAD
+
+Call Stack \(most recent call first\):
+ [^
+]*/Modules/CheckCSourceRuns.cmake:[0-9]+ \(cmake_check_source_runs\)
+ UnknownArgument.cmake:[0-9]+ \(check_c_source_runs\)
+ CMakeLists.txt:[0-9]+ \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Error at [^
]*/Modules/Internal/CheckSourceRuns.cmake:[0-9]+ \(message\):
Unknown argument:
diff --git a/Tests/RunCMake/CheckSourceRuns/UnknownArgument.cmake b/Tests/RunCMake/CheckSourceRuns/UnknownArgument.cmake
index 6e50fa7..927a6b0 100644
--- a/Tests/RunCMake/CheckSourceRuns/UnknownArgument.cmake
+++ b/Tests/RunCMake/CheckSourceRuns/UnknownArgument.cmake
@@ -1,5 +1,7 @@
enable_language (C)
+include(CheckCSourceRuns)
include(CheckSourceRuns)
-check_source_runs(C "int main() {return 0;}" SHOULD_BUILD SRC_EXT C BAD)
+check_c_source_runs("int main() {return 0;}" C_SHOULD_BUILD BAD)
+check_source_runs(C "int main() {return 0;}" SHOULD_BUILD SRC_EXT c BAD)