MantisBT - CMake
View Issue Details
0010438CMakeCMakepublic2010-03-18 08:242011-05-02 14:46
Lysius 
David Cole 
normalfeatureN/A
closedno change required 
 
CMake 2.8.4 
0010438: provide variables PROJECT_RELATIVE_DIR and [Project name]_RELATIVE_DIR
While looping through the subdirectories of my project, I frequently needed the relative path of the current directory relative to the main project directory. I'm using

string(REPLACE "${PROJECT_SOURCE_DIR}/" "" PROJECT_RELATIVE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")

at the moment, but I would be pleased if this variable was provided by default (together with [Project name]_RELATIVE_DIR).
No tags attached.
Issue History
2010-03-18 08:24LysiusNew Issue
2011-01-17 13:19David ColeAssigned To => David Cole
2011-01-17 13:19David ColeStatusnew => assigned
2011-01-17 13:33David ColeNote Added: 0024782
2011-01-17 13:33David ColeStatusassigned => resolved
2011-01-17 13:33David ColeFixed in Version => CMake 2.8.4
2011-01-17 13:33David ColeResolutionopen => no change required
2011-05-02 14:46David ColeNote Added: 0026344
2011-05-02 14:46David ColeStatusresolved => closed

Notes
(0024782)
David Cole   
2011-01-17 13:33   
CMake usage typically involves specifying files by full path name in most contexts. Some commands document relative path usage as relative to the current source directory, in which case relative paths are well defined.

It is unclear to me if this feature request is asking for relative path support for each subdir relative to just the top level, or to each dir above, or to ...? Could be N^2 if you want an any-to-any variable defined.

Since this is so easy to do for the cases where you *DO* want to define a variable, using string REPLACE, I do not see this as a necessary, or very useful addition to CMake.

Please re-open and comment, argue for your case if you feel strongly about this.

Thanks.
(0026344)
David Cole   
2011-05-02 14:46   
Closing resolved issues that have not been updated in more than 3 months.