[CMake] Strange search order of CMakeCache.txt
kent williams
nkwmailinglists at gmail.com
Fri Mar 5 15:38:34 EST 2010
I recently had to help out a CMake newbie, who had run CMake in the
source directory. Then he re-read the instructions on build setup for
our programs, and did it the right way -- i.e. he configured a build
directory for an out of source build.
Problem is, if you run CMake and configure the source directory, CMake
will assume you want an in-source build, even if you try and configure
an out-of-source build directory. So you get this mystifying behavior.
# sourcedir is 'test', in same directory as test-build
cd test # source dir
cmake # whoops, configured in the source directory!
cd ../test-build # come to senses, go to out-of-srouce build.
cmake ../test # try configuring for out of source build
make # now you get a "Makefile not found" error!
In order to get rid of the problem you have to delete CMakeCache.txt
in the source directory -- at a minimum -- before you can configure
the out-of-source build. I ended up going through the source code
trying to get rid of CMake droppings, which are numerous!
More information about the CMake
mailing list