Hello Sylvain,


       I have managed to do it with


       CMAKE_USE_RELATIVE_PATHS and CMAKE_SUPPRESS_REGENERATION


       cmake switches.. :)


       Thanks anyways for the reply!


Friday, November 17, 2006, 10:41:44 AM, you wrote:


>

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: [email protected] 

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:[EMAIL PROTECTED]


_______________________________________________

CMake mailing list

[email protected]

http://www.cmake.org/mailman/listinfo/cmake





-- 

Best regards,

 speedy                            mailto:[EMAIL PROTECTED]

_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to