Boost logo

Boost :

From: Douglas Gregor (dgregor_at_[hidden])
Date: 2007-08-17 08:47:36


Larry Evans wrote:
> Note: you have to remove CMakeCache.txt, if it exists.
>
>
> OK, so, in order to emulate Boost.Build's command line interface as
> close as possible, the user would create a bash (or whatever shell) file
> which has the one line:
>
> CXX=/home/evansl/download/gcc/variadic-templates\
> /gcc-4.3-20070323/install/bin/g++ \
> cmake $BOOST/src
>
> The only reason for this, which in this case is important, is to
> save repeatedly typing the long command between source code edits
> and testing. I assume the CMAKE_CXX_FLAGS:STRING value from
> the CMakeCache.txt is used since I saw the error message when
> make was run:
>
> Scanning dependencies of target boost_iostreams-shared
> [ 2%] Building CXX object
> libs/iostreams/src/CMakeFiles/boost_iostreams-shared.dir/file_descriptor.o
> cc1plus: error: unrecognized command line option "-std=gnu++0x"
> make[2]: ***
> [libs/iostreams/src/CMakeFiles/boost_iostreams-shared.dir/file_descriptor.o]
>
>
> This is inconsistent because the FLAGS value is used from
> CMakeCache.txt, but the CXX_COMPILER is ignored and even overwritten.
> Why put the CXX_COMPILER assignment in the CMakeCache.txt file if it's
> ignored?
>
It seems like there's a bit of a misunderstanding about the way CMake
actual works that is causing a lot of confusion.

The "cmake" program (and its more graphical cousin, "ccmake") generates
makefiles. You should only need to run "cmake" or "ccmake" once, to
configure your source tree. That execution creates the appropriate
makefiles, and you use your normal platform build tool (say, "make")
from there on. The only reason to re-run "cmake" is if you've changed
options, by editing CMakeCache.txt directly.

Personally, here's how I use CMake: I create a new build directory, and
run "ccmake /path/to/boost" from that directory. In that interface, I
set the options I'm interested in, (c)onfigure until they're stable, and
(g)enerate makefiles. It is very, very, very rare that I actually need
to run "cmake" or "ccmake" again after that, because calling "make"
automatically keeps everything else in sync.

    - Doug


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk