ENH: look in the PREFIX dir for the modules
This commit is contained in:
parent
a2b757aa2d
commit
31ab42e5b7
@ -133,20 +133,20 @@ void cmake::AddCMakePaths(const std::vector<std::string>& args)
|
|||||||
std::string cMakeSelf = args[0];
|
std::string cMakeSelf = args[0];
|
||||||
cmSystemTools::ConvertToUnixSlashes(cMakeSelf);
|
cmSystemTools::ConvertToUnixSlashes(cMakeSelf);
|
||||||
cMakeSelf = cmSystemTools::FindProgram(cMakeSelf.c_str());
|
cMakeSelf = cmSystemTools::FindProgram(cMakeSelf.c_str());
|
||||||
#ifdef CMAKE_BUILD_DIR
|
|
||||||
if(!cmSystemTools::FileExists(cMakeSelf.c_str()))
|
if(!cmSystemTools::FileExists(cMakeSelf.c_str()))
|
||||||
{
|
{
|
||||||
|
#ifdef CMAKE_BUILD_DIR
|
||||||
cMakeSelf = CMAKE_BUILD_DIR;
|
cMakeSelf = CMAKE_BUILD_DIR;
|
||||||
cMakeSelf += "/Source/cmake";
|
cMakeSelf += "/Source/cmake";
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
#ifdef CMAKE_PREFIX
|
#ifdef CMAKE_PREFIX
|
||||||
if(!cmSystemTools::FileExists(cMakeSelf.c_str()))
|
else if(!cmSystemTools::FileExists(cMakeSelf.c_str()))
|
||||||
{
|
{
|
||||||
cMakeSelf = CMAKE_PREFIX "/bin/cmake";
|
cMakeSelf = CMAKE_PREFIX "/bin/cmake";
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if(!cmSystemTools::FileExists(cMakeSelf.c_str()))
|
else if(!cmSystemTools::FileExists(cMakeSelf.c_str()))
|
||||||
{
|
{
|
||||||
cmSystemTools::Error("CMAKE can not find the command line program cmake. "
|
cmSystemTools::Error("CMAKE can not find the command line program cmake. "
|
||||||
"Attempted path: ", cMakeSelf.c_str());
|
"Attempted path: ", cMakeSelf.c_str());
|
||||||
@ -161,11 +161,13 @@ void cmake::AddCMakePaths(const std::vector<std::string>& args)
|
|||||||
|
|
||||||
// do CMAKE_ROOT, look for the environment variable first
|
// do CMAKE_ROOT, look for the environment variable first
|
||||||
std::string cMakeRoot;
|
std::string cMakeRoot;
|
||||||
|
std::string modules;
|
||||||
if (getenv("CMAKE_ROOT"))
|
if (getenv("CMAKE_ROOT"))
|
||||||
{
|
{
|
||||||
cMakeRoot = getenv("CMAKE_ROOT");
|
cMakeRoot = getenv("CMAKE_ROOT");
|
||||||
|
modules = cMakeRoot + "/Modules/FindVTK.cmake";
|
||||||
}
|
}
|
||||||
else
|
if(!cmSystemTools::FileExists(modules.c_str()))
|
||||||
{
|
{
|
||||||
// next try exe/..
|
// next try exe/..
|
||||||
cMakeRoot = cmSystemTools::GetProgramPath(cMakeSelf.c_str());
|
cMakeRoot = cmSystemTools::GetProgramPath(cMakeSelf.c_str());
|
||||||
@ -175,19 +177,36 @@ void cmake::AddCMakePaths(const std::vector<std::string>& args)
|
|||||||
cMakeRoot = cMakeRoot.substr(0, slashPos);
|
cMakeRoot = cMakeRoot.substr(0, slashPos);
|
||||||
}
|
}
|
||||||
// is there no Modules direcory there?
|
// is there no Modules direcory there?
|
||||||
std::string modules = cMakeRoot + "/Modules/FindVTK.cmake";
|
modules = cMakeRoot + "/Modules/FindVTK.cmake";
|
||||||
if (!cmSystemTools::FileExists(modules.c_str()))
|
}
|
||||||
|
|
||||||
|
else if (!cmSystemTools::FileExists(modules.c_str()))
|
||||||
{
|
{
|
||||||
// try exe/../share/cmake
|
// try exe/../share/cmake
|
||||||
modules = cMakeRoot + "/share/CMake/Modules/FindVTK.cmake";
|
modules = cMakeRoot + "/share/CMake/Modules/FindVTK.cmake";
|
||||||
if (!cmSystemTools::FileExists(modules.c_str()))
|
}
|
||||||
{
|
|
||||||
#ifdef CMAKE_ROOT_DIR
|
#ifdef CMAKE_ROOT_DIR
|
||||||
|
else if (!cmSystemTools::FileExists(modules.c_str()))
|
||||||
|
{
|
||||||
// try compiled in value on UNIX
|
// try compiled in value on UNIX
|
||||||
cMakeRoot = CMAKE_ROOT_DIR;
|
cMakeRoot = CMAKE_ROOT_DIR;
|
||||||
modules = cMakeRoot + "/Modules/FindVTK.cmake";
|
modules = cMakeRoot + "/Modules/FindVTK.cmake";
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
if (!cmSystemTools::FileExists(modules.c_str()))
|
#ifdef CMAKE_PREFIX
|
||||||
|
else if (!cmSystemTools::FileExists(modules.c_str()))
|
||||||
|
{
|
||||||
|
// try compiled in value on UNIX
|
||||||
|
cMakeRoot = CMAKE_PREFIX "/share/CMake";
|
||||||
|
modules = cMakeRoot + "/Modules/FindVTK.cmake";
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
else if (!cmSystemTools::FileExists(modules.c_str()))
|
||||||
|
{
|
||||||
|
cMakeRoot = cMakeRoot + "/share/CMake";
|
||||||
|
modules = cMakeRoot + "/Modules/FindVTK.cmake";
|
||||||
|
}
|
||||||
|
else if (!cmSystemTools::FileExists(modules.c_str()))
|
||||||
{
|
{
|
||||||
// couldn't find modules
|
// couldn't find modules
|
||||||
cmSystemTools::Error("Could not find CMAKE_ROOT !!!\n",
|
cmSystemTools::Error("Could not find CMAKE_ROOT !!!\n",
|
||||||
@ -195,14 +214,6 @@ void cmake::AddCMakePaths(const std::vector<std::string>& args)
|
|||||||
modules.c_str());
|
modules.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cMakeRoot = cMakeRoot + "/share/CMake";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cmCacheManager::GetInstance()->AddCacheEntry
|
cmCacheManager::GetInstance()->AddCacheEntry
|
||||||
("CMAKE_ROOT", cMakeRoot.c_str(),
|
("CMAKE_ROOT", cMakeRoot.c_str(),
|
||||||
"Path to CMake installation.", cmCacheManager::INTERNAL);
|
"Path to CMake installation.", cmCacheManager::INTERNAL);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user