build_command: Fail early without CMAKE_MAKE_PROGRAM (#14005)
If CMAKE_MAKE_PROGRAM is not set fail with an error message instead of crashing. Suggest calling project() or enable_language() first to ensure that CMAKE_MAKE_PROGRAM is set.
This commit is contained in:
parent
4e5cb37590
commit
2e1c2bd2dd
|
@ -87,6 +87,14 @@ bool cmBuildCommand
|
||||||
|
|
||||||
const char* makeprogram
|
const char* makeprogram
|
||||||
= this->Makefile->GetDefinition("CMAKE_MAKE_PROGRAM");
|
= this->Makefile->GetDefinition("CMAKE_MAKE_PROGRAM");
|
||||||
|
if(!makeprogram)
|
||||||
|
{
|
||||||
|
this->Makefile->IssueMessage(
|
||||||
|
cmake::FATAL_ERROR,
|
||||||
|
"build_command() requires CMAKE_MAKE_PROGRAM to be defined. "
|
||||||
|
"Call project() or enable_language() first.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// If null/empty CONFIGURATION argument, GenerateBuildCommand uses 'Debug'
|
// If null/empty CONFIGURATION argument, GenerateBuildCommand uses 'Debug'
|
||||||
// in the currently implemented multi-configuration global generators...
|
// in the currently implemented multi-configuration global generators...
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
1
|
|
@ -0,0 +1,5 @@
|
||||||
|
CMake Error at BeforeProject.cmake:[0-9]+ \(build_command\):
|
||||||
|
build_command\(\) requires CMAKE_MAKE_PROGRAM to be defined. Call project\(\)
|
||||||
|
or enable_language\(\) first.
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMakeLists.txt:[0-9]+ \(include\)
|
|
@ -0,0 +1,2 @@
|
||||||
|
build_command(MAKECOMMAND_DEFAULT_VALUE)
|
||||||
|
project(${RunCMake_TEST} NONE)
|
|
@ -1,3 +1,5 @@
|
||||||
cmake_minimum_required(VERSION 2.8)
|
cmake_minimum_required(VERSION 2.8)
|
||||||
project(${RunCMake_TEST} NONE)
|
if(NOT NoProject)
|
||||||
|
project(${RunCMake_TEST} NONE)
|
||||||
|
endif()
|
||||||
include(${RunCMake_TEST}.cmake)
|
include(${RunCMake_TEST}.cmake)
|
||||||
|
|
|
@ -2,3 +2,7 @@ include(RunCMake)
|
||||||
|
|
||||||
run_cmake(ErrorsOFF)
|
run_cmake(ErrorsOFF)
|
||||||
run_cmake(ErrorsON)
|
run_cmake(ErrorsON)
|
||||||
|
|
||||||
|
set(RunCMake_TEST_OPTIONS -DNoProject=1)
|
||||||
|
run_cmake(BeforeProject)
|
||||||
|
unset(RunCMake_TEST_OPTIONS)
|
||||||
|
|
Loading…
Reference in New Issue