[CMake] get the relative path of current directory

blinkeye gentoo at blinkeye.ch
Sun Mar 22 07:06:54 EDT 2009


Use case:

You start developing src/prototype1 which implements feature X. Next, you copy
src/prototype1 to src/prototype2 and implement feature Y or enhance feature X.
You don't branch because you're constantly comparing these prototypes against
each others (say for speed).

To make this really easy I need a way of getting the ${RELATIVE_SOURCE_DIR} of
such a prototype so I can copy src/prototype1 to src/prototypeX without
adjusting src/prototypeX/CMakeLists.txt:

set( EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin/${RELATIVE_SOURCE_DIR} )

So, the only thing one needs to adjust is the project's top CMakeLists.txt and
add the new prototype's source dir to the SUBDIRS directive.

Is this possible?


More information about the CMake mailing list