Just finished figuring out why CMake was behaving strangely for me:

Originally I built out of tree:

mkdir build
cd build
cmake ../src

However at some point it appears I screwed up and typed 'cmake' in /src

Thereafter cmake was ignoring the build path and writing all Makefiles in /src; I would try to change something using cmake ../src -DMYVAR=MYVALUE, but the change would be mysteriously ignored... because it was ignoring the cwd /build and updating /src/Makefile, whilst I was using /build/Makefile.

Is it ever valid to build in-tree and also build out-of-tree from the same source tree? If so then it probably shouldn't ignore the (cwd) build path like that. If not then it should be a fatal error or at least a warning that your out of tree build is not actually being updated. In other words, it is a tricky trap that "cmake ../src" /might/ mean "update the Makefiles in ../src" or /might/ mean "update the Makefiles in the current directory using the CMakeLists.txt in ../src"

At the moment you get:

Build files have been written to: /src

Which does indicate the problem, but because the message is routine and so I ignore it every day, I didn't notice it for quite some time.

Chris
--

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

Reply via email to