mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-08 07:10:12 -05:00
find_*: Add support for REQUIRED keyword
In the same spirit as the REQUIRED keyword on find_package, this will stop cmake execution with an error on a failed find_program, find_file, find_path or find_library.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "cmFindProgramCommand.h"
|
||||
|
||||
#include "cmMakefile.h"
|
||||
#include "cmMessageType.h"
|
||||
#include "cmStateTypes.h"
|
||||
#include "cmStringAlgorithms.h"
|
||||
#include "cmSystemTools.h"
|
||||
@@ -136,6 +137,13 @@ bool cmFindProgramCommand::InitialPass(std::vector<std::string> const& argsIn)
|
||||
this->Makefile->AddCacheDefinition(
|
||||
this->VariableName, (this->VariableName + "-NOTFOUND").c_str(),
|
||||
this->VariableDocumentation.c_str(), cmStateEnums::FILEPATH);
|
||||
if (this->Required) {
|
||||
this->Makefile->IssueMessage(
|
||||
MessageType::FATAL_ERROR,
|
||||
"Could not find " + this->VariableName +
|
||||
" using the following names: " + cmJoin(this->Names, ", "));
|
||||
cmSystemTools::SetFatalErrorOccured();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user