Relative paths in project files
Added by Christophe Delépine almost 15 years ago
Hello,
I am using cmake-gui to generate project files for Visual Studio 2005.
The problem is that all the paths are absolute instead of being relative to each project's root directory.
Changing the paths manually is really tedious because the following must be changed :
C/C:General:Additional Include Directories
C/C:Output Files:Program Database File Name
Librarian:General:Output File
Custom Build Step:Command Line
Custom Build Step:Outputs
Custom Build Step:Additional Dependencies
Given the number of compilation targets and projects, it is really a nightmare !
Is there any solution to generate relative paths from cmake-gui or any other tool ??
Regards
Christophe
Replies (1)
RE: Relative paths in project files - Added by Wim Dumon almost 15 years ago
Christophe,
There's some discussion about CMAKE_USE_RELATIVE_PATHS on the cmake mailing list, but it looks like this parameter generally does not work. Maybe you're lucky? This question is better asked on the cmake mailing list.
As alternative to edit through the UI, can't you use cygwin and a sed script to turn absolute paths in relative paths on the generated project files?
for i in `find -name \*prj`; do sed s/c:\\my\\relative\\path\\//g < $i > $i.rel; mv $i.rel $i; done
(I didn't test this, the number of backslashes in the regexp may be wrong)
Out of curiosity, why do you want to do this?
Regards,
Wim.