Find directory where target is defined

Viewed 4162

Is there a way in cmake to find the source directory of the CMakeLists.txt file in which a target was defined?

Somethign like:

if (TARGET Foo)
    message("Library Foo was alread built in ${LOCATION_OF_FOOS_CMAKE}")
else()
    add_library(Foo ...)
endif()

Edit:
Unfortunately, my cmake scripts have to work on a default ubuntu 14.04 installation. So I'm limited to cmake 2.8

1 Answers
Related