summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Adam <zanchey@ucc.gu.uwa.edu.au>2017-11-24 07:50:14 (GMT)
committerDavid Adam <zanchey@ucc.gu.uwa.edu.au>2017-11-24 07:54:00 (GMT)
commitb31d5e1dfdea5abcf95de05baf7b0e53cc18937a (patch)
tree724d922bcb0f098b4a946d33eb8e12c1b5c50a8a
parent1f1c2a9fdf84e1fb6f3399f7f30ad8b7c8d8669d (diff)
downloadCMake-b31d5e1dfdea5abcf95de05baf7b0e53cc18937a.zip
CMake-b31d5e1dfdea5abcf95de05baf7b0e53cc18937a.tar.gz
CMake-b31d5e1dfdea5abcf95de05baf7b0e53cc18937a.tar.bz2
CheckIncludeFiles: improve warning for missing argument
-rw-r--r--Modules/CheckIncludeFiles.cmake8
-rw-r--r--Tests/RunCMake/CheckModules/CheckIncludeFilesMissingLanguage-stderr.txt4
2 files changed, 7 insertions, 5 deletions
diff --git a/Modules/CheckIncludeFiles.cmake b/Modules/CheckIncludeFiles.cmake
index 1a217b3..347231c 100644
--- a/Modules/CheckIncludeFiles.cmake
+++ b/Modules/CheckIncludeFiles.cmake
@@ -49,12 +49,14 @@ macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
elseif(CMAKE_CXX_COMPILER_LOADED)
set(_lang CXX)
else()
- message(FATAL_ERROR "CHECK_INCLUDE_FILES needs either C or CXX language enabled")
+ message(FATAL_ERROR "CHECK_INCLUDE_FILES needs either C or CXX language enabled.\n")
endif()
elseif("x${ARGN}" MATCHES "^xLANGUAGE;([a-zA-Z]+)$")
- set(_lang "${CMAKE_MATCH_1}")
+ set(_lang "${CMAKE_MATCH_1}")
+ elseif("x${ARGN}" MATCHES "^xLANGUAGE$")
+ message(FATAL_ERROR "No languages listed for LANGUAGE option.\nSupported languages: C, CXX.\n")
else()
- message(FATAL_ERROR "Unknown arguments:\n ${ARGN}\n")
+ message(FATAL_ERROR "Unknown arguments:\n ${ARGN}\n")
endif()
if(_lang STREQUAL "C")
diff --git a/Tests/RunCMake/CheckModules/CheckIncludeFilesMissingLanguage-stderr.txt b/Tests/RunCMake/CheckModules/CheckIncludeFilesMissingLanguage-stderr.txt
index 4b31dbd..36c28f9 100644
--- a/Tests/RunCMake/CheckModules/CheckIncludeFilesMissingLanguage-stderr.txt
+++ b/Tests/RunCMake/CheckModules/CheckIncludeFilesMissingLanguage-stderr.txt
@@ -1,7 +1,7 @@
CMake Error at .*/Modules/CheckIncludeFiles.cmake:[0-9]+. \(message\):
- Unknown arguments:
+ No languages listed for LANGUAGE option.
- LANGUAGE
+ Supported languages: C, CXX.
Call Stack \(most recent call first\):
CheckIncludeFilesMissingLanguage.cmake:[0-9]+ \(check_include_files\)