[CMake] relative paths for visual studio generators?
Sylvain Benner
benner at virtools.com
Fri Nov 17 04:41:44 EST 2006
I'm far from a CMake expert, so maybe this answer is not optimal.
To support relative path for dependencies I have patched the method:
cmGlobalVisualStudio71Generator::WriteProject
Here is the modified version (sorry I don't know how to do a patch file, fortunately it is a small method):
void
cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
const char* dspname,
const char* dir,
cmTarget& t)
{
std::string d;
if(cmSystemTools::FileIsFullPath(dir))
{
d = cmSystemTools::RelativePath(this->GetLocalGenerator(0)->GetMakefile()->GetStartOutputDirectory(), dir);
if(d.empty())
{
d = ".";
}
}
else
{
d = dir;
}
cmSystemTools::ReplaceString(d, "/", "\\");
fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \""
<< dspname << "\", \""
<< d << "\\" << dspname << ".vcproj\", \"{"
<< this->GetGUID(dspname) << "}\"\n";
fout << "\tProjectSection(ProjectDependencies) = postProject\n";
this->WriteProjectDepends(fout, dspname, dir, t);
fout << "\tEndProjectSection\n";
fout <<"EndProject\n";
}
For the files I think it is not a problem. First, you should separate your vcproj and your source files. With the patch above you can move easily the vcproj folder tree and it will always work.
If you still want to change the location of your source files, you just have to check out your vcproj files, launch CMake, and check in the projects with a meaningfull comment like: "changed location of sources files from ... to ..."
Sylvain
----- Original Message -----
From: speedy
To: cmake at cmake.org
Sent: Thursday, November 16, 2006 8:20 PM
Subject: [CMake] relative paths for visual studio generators?
Hello Cmake crew,
is there a way for cmake to generate relative paths to dependencies and files
like the VisualStudio IDE does by default?
Those full paths make .vcproj files very hard to version control and checkout
into different folders requires deleting and creating them anew by cmake .
Thanks!
--
Best regards,
speedy mailto:speedy at 3d-io.com
------------------------------------------------------------------------------
_______________________________________________
CMake mailing list
CMake at cmake.org
http://www.cmake.org/mailman/listinfo/cmake
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20061117/51eed11d/attachment.htm
More information about the CMake
mailing list