[Cmake] CMAKE_ROOT
Bill Hoffman
bill.hoffman at kitware.com
Wed May 30 11:31:19 EDT 2001
Search for CMAKE_ROOT in the MFC dialog source, and you can see what you need
to do.
//! Load cache file from m_WhereBuild and display in GUI editor
void CMakeSetupDialog::LoadCacheFromDiskToGUI()
{
if(m_WhereBuild != "")
{
cmCacheManager::GetInstance()->LoadCache(m_WhereBuild);
// Find our own exectuable.
char fname[1024];
::GetModuleFileName(NULL,fname,1023);
std::string root = cmSystemTools::GetProgramPath(fname);
std::string::size_type slashPos = root.rfind("/");
if(slashPos != std::string::npos)
{
root = root.substr(0, slashPos);
}
cmCacheManager::GetInstance()->AddCacheEntry
("CMAKE_ROOT", root.c_str(),
"Path to CMake installation.", cmCacheManager::INTERNAL);
std::string cMakeCMD = "\""+cmSystemTools::GetProgramPath(fname);
cMakeCMD += "/cmake.exe\"";
// Save the value in the cache
cmCacheManager::GetInstance()->AddCacheEntry("CMAKE_COMMAND",
cMakeCMD.c_str(),
"Path to CMake executable.",
cmCacheManager::INTERNAL);
this->FillCacheGUIFromCacheManager();
}
}
However, that being said, I am about to change the GUI code to use
the cmake class that the command line version uses. Once that is done,
it will be easier to write a GUI.
At 04:06 PM 5/30/2001 +0100, John Biddiscombe wrote:
>>How are you trying to run it? I assume you are not running the GUI..
>
>I've got my own GUI and all I do is this
>
> if (makefile) delete makefile;
> makefile = new cmMakefile();
> //
> if (pg) delete pg;
> pg = new cmBCBMakefile(NULL); * * * * * * LOOK HERE !!!!
> //
> makefile->SetMakefileGenerator(pg);
> makefile->SetHomeDirectory(e_vtkdir->Text.c_str());
> makefile->SetStartDirectory(e_vtkdir->Text.c_str());
> makefile->SetStartOutputDirectory(e_output->Text.c_str());
> makefile->SetHomeOutputDirectory(e_output->Text.c_str());
> //
> makefile->MakeStartDirectoriesCurrent();
> cmCacheManager::GetInstance()->LoadCache(makefile);
> makefile->ReadListFile(e_makelists->Text.c_str());
> makefile->GenerateMakefile();
> this->FillCacheGUIFromCacheManager();
>
>I just get endless errors when doing
>makefile->ReadListFile(e_makelists->Text.c_str());
>I've added CMAKE_ROOT to my cache, but the real problem is that it seems it never gets expanded out to its value, the error says
>can't find....$(CMAKE_ROOT)/modules/opengl.cmake
>which means it never converts CMAKE_ROOT into a path.
>
>If I look at MSProject generator, which does this
>
>void cmMSProjectGenerator::ComputeSystemInfo()
>{
> // now load the settings
> std::string fpath =
> cmCacheManager::GetInstance()->GetCacheValue("CMAKE_ROOT");
> fpath += "/Templates/CMakeWindowsSystemConfig.cmake";
> m_Makefile->ReadListFile(NULL,fpath.c_str());
>}
>
>it just crashes with access violation on the GetCacheValue stuff
>
>any help gratefully received.
>
>JB
More information about the CMake
mailing list