[CMake] CMake add_definitions string definitions fails on OS X

Andrew Zhilka hotsmileband at gmail.com
Wed Oct 21 06:07:48 EDT 2015


Hi all!

I am using CMake and g++ on OS X 10.10.
My problem is following: in CMakeLists.txt I add line:
add_definitions(-DPROJECT_ROOT="${CMAKE_CURRENT_SOURCE_DIR}/../..")

When I try to use PROJECT_ROOT in source code I can not build it.
It says

error: expected expression
    std::cout << PROJECT_ROOT;
                       ^
expanded from here
#define PROJECT_ROOT "...."

I have tried the very same thing on Linux and it worked well. Could anyone,
please, suggest anything?

Regards,
Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20151021/e281d53e/attachment.html>


More information about the CMake mailing list