From: Larry Evans (cppljevans_at_[hidden])
Date: 2007-08-17 09:42:25
On 08/17/2007 07:47 AM, Douglas Gregor wrote:
> 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:
>> /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
>> cc1plus: error: unrecognized command line option "-std=gnu++0x"
>> make: ***
>> 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
> 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.
Doug, I did understand that cmake generates Makefiles; however,
I thought editing the CMakeCache.txt file to change the compiler
*then* running cmake would use the new compiler when generating
the Makefile. But that's apparently wrong. Whenever I did that
(edit CMakeCache.txt; run cmake) the CMakeCache.txt file value
for the compiler was changed *back* to the value before the
manual edit. As Maik indicated, the only way to get a new
value for the compiler was with the command line invokation of
cmake. The following shows the contents of the bash script file
I used to do this:
Compilation finished at Fri Aug 17 08:38:11
What's confusing is when ccmake is used and expert mode is turned on,
the value for CMAKE_CXX_COMPILER is shown, but changing that, just
like manually editing the CMakeCache.txt file to change it. has no
effect. That's not very intuitive.
> 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.
I tried that (at least I pretty sure that's what I did); yet, the
CXX compiler was not retained when I ran cmake.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk