From b31d5e1dfdea5abcf95de05baf7b0e53cc18937a Mon Sep 17 00:00:00 2001 From: David Adam Date: Fri, 24 Nov 2017 15:50:14 +0800 Subject: CheckIncludeFiles: improve warning for missing argument --- Modules/CheckIncludeFiles.cmake | 8 +++++--- .../CheckModules/CheckIncludeFilesMissingLanguage-stderr.txt | 4 ++-- 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\) -- cgit v0.12