|
@@ -12,7 +12,6 @@
|
|
|
|
|
|
|
|
#include "cmGlobalGenerator.h"
|
|
#include "cmGlobalGenerator.h"
|
|
|
#include "cmMakefile.h"
|
|
#include "cmMakefile.h"
|
|
|
-#include "cmMessageType.h"
|
|
|
|
|
#include "cmProperty.h"
|
|
#include "cmProperty.h"
|
|
|
#include "cmState.h"
|
|
#include "cmState.h"
|
|
|
#include "cmStateTypes.h"
|
|
#include "cmStateTypes.h"
|
|
@@ -22,30 +21,26 @@
|
|
|
class cmExecutionStatus;
|
|
class cmExecutionStatus;
|
|
|
|
|
|
|
|
cmFindLibraryCommand::cmFindLibraryCommand(cmExecutionStatus& status)
|
|
cmFindLibraryCommand::cmFindLibraryCommand(cmExecutionStatus& status)
|
|
|
- : cmFindBase(status)
|
|
|
|
|
|
|
+ : cmFindBase("find_library", status)
|
|
|
{
|
|
{
|
|
|
this->EnvironmentPath = "LIB";
|
|
this->EnvironmentPath = "LIB";
|
|
|
this->NamesPerDirAllowed = true;
|
|
this->NamesPerDirAllowed = true;
|
|
|
|
|
+ this->VariableDocumentation = "Path to a library.";
|
|
|
|
|
+ this->VariableType = cmStateEnums::FILEPATH;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// cmFindLibraryCommand
|
|
// cmFindLibraryCommand
|
|
|
bool cmFindLibraryCommand::InitialPass(std::vector<std::string> const& argsIn)
|
|
bool cmFindLibraryCommand::InitialPass(std::vector<std::string> const& argsIn)
|
|
|
{
|
|
{
|
|
|
this->DebugMode = this->ComputeIfDebugModeWanted();
|
|
this->DebugMode = this->ComputeIfDebugModeWanted();
|
|
|
- this->VariableDocumentation = "Path to a library.";
|
|
|
|
|
this->CMakePathName = "LIBRARY";
|
|
this->CMakePathName = "LIBRARY";
|
|
|
|
|
+
|
|
|
if (!this->ParseArguments(argsIn)) {
|
|
if (!this->ParseArguments(argsIn)) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
if (this->AlreadyInCache) {
|
|
if (this->AlreadyInCache) {
|
|
|
- // If the user specifies the entry on the command line without a
|
|
|
|
|
- // type we should add the type and docstring but keep the original
|
|
|
|
|
- // value.
|
|
|
|
|
- if (this->AlreadyInCacheWithoutMetaInfo) {
|
|
|
|
|
- this->Makefile->AddCacheDefinition(this->VariableName, "",
|
|
|
|
|
- this->VariableDocumentation.c_str(),
|
|
|
|
|
- cmStateEnums::FILEPATH);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ this->NormalizeFindResult();
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -75,24 +70,7 @@ bool cmFindLibraryCommand::InitialPass(std::vector<std::string> const& argsIn)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
std::string const library = this->FindLibrary();
|
|
std::string const library = this->FindLibrary();
|
|
|
- if (!library.empty()) {
|
|
|
|
|
- // Save the value in the cache
|
|
|
|
|
- this->Makefile->AddCacheDefinition(this->VariableName, library,
|
|
|
|
|
- this->VariableDocumentation.c_str(),
|
|
|
|
|
- cmStateEnums::FILEPATH);
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
- std::string notfound = this->VariableName + "-NOTFOUND";
|
|
|
|
|
- this->Makefile->AddCacheDefinition(this->VariableName, notfound,
|
|
|
|
|
- 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();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ this->StoreFindResult(library);
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -208,7 +186,8 @@ std::string cmFindLibraryCommand::FindLibrary()
|
|
|
|
|
|
|
|
struct cmFindLibraryHelper
|
|
struct cmFindLibraryHelper
|
|
|
{
|
|
{
|
|
|
- cmFindLibraryHelper(cmMakefile* mf, cmFindBase const* findBase);
|
|
|
|
|
|
|
+ cmFindLibraryHelper(std::string debugName, cmMakefile* mf,
|
|
|
|
|
+ cmFindBase const* findBase);
|
|
|
|
|
|
|
|
// Context information.
|
|
// Context information.
|
|
|
cmMakefile* Makefile;
|
|
cmMakefile* Makefile;
|
|
@@ -280,11 +259,11 @@ struct cmFindLibraryHelper
|
|
|
};
|
|
};
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-cmFindLibraryHelper::cmFindLibraryHelper(cmMakefile* mf,
|
|
|
|
|
|
|
+cmFindLibraryHelper::cmFindLibraryHelper(std::string debugName, cmMakefile* mf,
|
|
|
cmFindBase const* base)
|
|
cmFindBase const* base)
|
|
|
: Makefile(mf)
|
|
: Makefile(mf)
|
|
|
, DebugMode(base->DebugModeEnabled())
|
|
, DebugMode(base->DebugModeEnabled())
|
|
|
- , DebugSearches("find_library", base)
|
|
|
|
|
|
|
+ , DebugSearches(std::move(debugName), base)
|
|
|
{
|
|
{
|
|
|
this->GG = this->Makefile->GetGlobalGenerator();
|
|
this->GG = this->Makefile->GetGlobalGenerator();
|
|
|
|
|
|
|
@@ -485,7 +464,7 @@ std::string cmFindLibraryCommand::FindNormalLibrary()
|
|
|
std::string cmFindLibraryCommand::FindNormalLibraryNamesPerDir()
|
|
std::string cmFindLibraryCommand::FindNormalLibraryNamesPerDir()
|
|
|
{
|
|
{
|
|
|
// Search for all names in each directory.
|
|
// Search for all names in each directory.
|
|
|
- cmFindLibraryHelper helper(this->Makefile, this);
|
|
|
|
|
|
|
+ cmFindLibraryHelper helper(this->FindCommandName, this->Makefile, this);
|
|
|
for (std::string const& n : this->Names) {
|
|
for (std::string const& n : this->Names) {
|
|
|
helper.AddName(n);
|
|
helper.AddName(n);
|
|
|
}
|
|
}
|
|
@@ -502,7 +481,7 @@ std::string cmFindLibraryCommand::FindNormalLibraryNamesPerDir()
|
|
|
std::string cmFindLibraryCommand::FindNormalLibraryDirsPerName()
|
|
std::string cmFindLibraryCommand::FindNormalLibraryDirsPerName()
|
|
|
{
|
|
{
|
|
|
// Search the entire path for each name.
|
|
// Search the entire path for each name.
|
|
|
- cmFindLibraryHelper helper(this->Makefile, this);
|
|
|
|
|
|
|
+ cmFindLibraryHelper helper(this->FindCommandName, this->Makefile, this);
|
|
|
for (std::string const& n : this->Names) {
|
|
for (std::string const& n : this->Names) {
|
|
|
// Switch to searching for this name.
|
|
// Switch to searching for this name.
|
|
|
helper.SetName(n);
|
|
helper.SetName(n);
|