[CMake] Accessing source directory of a target

Robert Dailey rcdailey.lists at gmail.com
Fri Jun 12 17:16:26 EDT 2015


Hello,

Is there a SOURCE_DIR property for targets? I wasn't able to find
anything in the documentation on this, however I thought I saw
something similar to this a few years ago. I'm using CMake 3.2.
Basically I want the equivalent of CMAKE_CURRENT_SOURCE_DIR, but for a
specific project.

Documentation states you can do <TARGET>_SOURCE_DIR, but this value is
empty for me. Unless this is for projects, not targets (i.e. the value
passed to the project() command).

Thanks in advance.


More information about the CMake mailing list