Boost logo

Boost :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2007-08-16 16:42:02


On 08/16/2007 01:42 PM, Maik Beckmann wrote:
> Am Donnerstag, 16. August 2007 20:10:48 schrieb Larry Evans:
>> I tried this by creating a top-level build directory, built-by, with
>> subdirectories:
>>
>> g++-4.1 #the "regular" compiler
>> g++-4.3_v #the "variadic" compiler
>>
>> For 4.3_v, I had to first do `cmake <path-to-source>` then edit the
>> g++-4.3_v/CMakeCache.txt to include the lines:
>>
>> //CXX compiler.
>> CMAKE_CXX_COMPILER:FILEPATH=/home/evansl/download/gcc/variadic-templates/gc
>> c-4.3-20070323/install/bin/g++
>>
>> //Flags used by the compiler during all build types.
>> CMAKE_CXX_FLAGS:STRING=-std=gnu++0x
>>
>> The FLAGS value was needed, as you know, to enable variadic templates.
>>
>> However, after I tried `make` the value of COMPILER:FILEPATH was
>> reverted back to /usr/bin/g++ by something. How can that reversion be
>> prevented or is there a better way to cause the variadic compiler to be
>> used?
>
> Hello Larry,
>
> If you want to say CMake which compiler it has to use, you must give it via
> the matching environment variable (CXX for the c++ compiler, CC for c, FC for
> fortran) like:
> $ cd /path/to/builddir
> $ CXX=/home/evansl/download/gcc/variadic-templates\
> /gcc-4.3-20070323/install/bin/g++ \
> cmake /path/to/boost-cmake

Or, a more descriptive name than /path/to/boost-cmake would be
$BOOST/src, which is what's used on:

http://svn.boost.org/trac/boost/wiki/CMakeConfigAndBuild

>
> 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?

> This behavior of CMake ensures that the results of the test CMake runs on the
> compiler are allway valid. Since the results are stored in CMakeLists.txt,

Which CMakeLists.txt? The following command:

cd ~/prog_dev/boost-svn/ro/sandbox-branches/boost-cmake/src/
find . -name CMakeLists.txt -ls
5181833 12 -rw-r--r-- 1 evansl evansl 10169 Aug 13 16:16
./libs/config/test/CMakeLists.txt
...

shows no times later than yesterday; hence, it's unclear to me what
'results are stored in CMakeLists.txt' means. Could you please clarify?

> you have to remove it, which triggers CMake to rerun the compiler tests.

Does 'it' refer to CMakeLists.txt or CMakeCache.txt?

>
> Regards, Maik Beckmann

Thanks for the feedback!

-regards,
Larry


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