Hi,

thanks for your reply.

I am using an out-of-source build, and my build system even contains
rules to explicitly prohibit in-source builds.

To make __FILE__ behave correctly, you'd have to invoke the compiler
with a different cwd.

A generated line in build.make, which currently looks like this:

cd /home/mic/git/openage/.bin/gcc-release-O2/cpp && /usr/bin/g++
$(CXX_DEFINES) $(CXX_FLAGS) -o CMakeFiles/openage.dir/engine.cpp.o -c
/home/mic/git/openage/cpp/engine.cpp

would need to be changed to

cd /home/mic/git/openage && /usr/bin/g++ $(CXX_DEFINES) $(CXX_FLAGS) -o
/home/mic/git/openage/.bin/gcc-release-O2/cpp/CMakeFiles/openage.dir/engine.cpp.o
-c cpp/engine.cpp

The solution I'm currently using is similar to the one you're
suggesting; note that your suggestion can lead to misleading debug
messages or even undefined behavior in the event that __FILE__ does not
start with CMAKE_SOURCE_DIR for whatever reason.

I'm not using any non-library include paths, so the include issue
doesn't apply to my.

~ Michael

Attachment: signature.asc
Description: OpenPGP digital signature

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to