Merge branch 'fix-crash-on-bad-LANG_STANDARD' into release
This commit is contained in:
commit
6b6852a0eb
|
@ -2265,7 +2265,14 @@ AddCompilerRequirementFlag(std::string &flags, cmTarget* target,
|
||||||
|
|
||||||
std::vector<std::string>::const_iterator stdIt =
|
std::vector<std::string>::const_iterator stdIt =
|
||||||
std::find(stds.begin(), stds.end(), standard);
|
std::find(stds.begin(), stds.end(), standard);
|
||||||
assert(stdIt != stds.end());
|
if (stdIt == stds.end())
|
||||||
|
{
|
||||||
|
std::string e =
|
||||||
|
lang + "_STANDARD is set to invalid value '" + standard + "'";
|
||||||
|
this->GetGlobalGenerator()->GetCMakeInstance()
|
||||||
|
->IssueMessage(cmake::FATAL_ERROR, e, target->GetBacktrace());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<std::string>::const_iterator defaultStdIt =
|
std::vector<std::string>::const_iterator defaultStdIt =
|
||||||
std::find(stds.begin(), stds.end(), defaultStd);
|
std::find(stds.begin(), stds.end(), defaultStd);
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
1
|
|
@ -0,0 +1,4 @@
|
||||||
|
CMake Error at NotAStandard.cmake:[0-9]+ \(add_library\):
|
||||||
|
CXX_STANDARD is set to invalid value 'bad'
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMakeLists.txt:[0-9]+ \(include\)
|
|
@ -0,0 +1,2 @@
|
||||||
|
set(CMAKE_CXX_STANDARD bad)
|
||||||
|
add_library(somelib STATIC empty.cpp)
|
|
@ -43,6 +43,8 @@ else()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CXX_STANDARD_DEFAULT)
|
if(CXX_STANDARD_DEFAULT)
|
||||||
|
run_cmake(NotAStandard)
|
||||||
|
|
||||||
foreach(standard 98 11)
|
foreach(standard 98 11)
|
||||||
file(READ
|
file(READ
|
||||||
"${RunCMake_BINARY_DIR}/generate_feature_list-build/cxx${standard}_flag.txt"
|
"${RunCMake_BINARY_DIR}/generate_feature_list-build/cxx${standard}_flag.txt"
|
||||||
|
|
Loading…
Reference in New Issue