MantisBT - CMake
View Issue Details
0012530CMakeCCMakepublic2011-10-21 07:402011-11-01 06:10
tasptz 
Alex Neundorf 
lowminoralways
closedno change required 
x86_64 GNU/LinuxUbuntu10.04
CMake 2.8.6 
 
0012530: Problem with ccmake and Toolchain file
Hello,

I want to use a self compiled gcc 4.6 instead of the system's gcc 4.5. Therefore I wrote a simple toolchain file:

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_C_COMPILER "/opt/gcc-4.6.0/bin/gcc-4.6")
set(CMAKE_CXX_COMPILER "/opt/gcc-4.6.0/bin/g++-4.6")
include_directories(BEFORE SYSTEM "/opt/gcc-4.6.0/include")

If I use this with ccmake (empty build directory):
ccmake -DCMAKE_TOOLCHAIN_FILE=../Toolchain-gcc46.cmake ../src/

I get:
You have changed variables that require your cache to be deleted.
 Configure will be re-run and you may have to reset some variables.
 The following variables have changed:
 CMAKE_C_COMPILER= /usr/bin/gcc-4.5
 CMAKE_CXX_COMPILER= /usr/bin/g++-4.5

If I use cmake-gui and specify the toolchain file everything is fine.
No tags attached.
Issue History
2011-10-21 07:40tasptzNew Issue
2011-11-01 06:09Alex NeundorfNote Added: 0027691
2011-11-01 06:09Alex NeundorfStatusnew => closed
2011-11-01 06:09Alex NeundorfResolutionopen => no change required
2011-11-01 06:09Alex NeundorfAssigned To => Alex Neundorf
2011-11-01 06:09Alex NeundorfNote Added: 0027692
2011-11-01 06:09Alex NeundorfStatusclosed => feedback
2011-11-01 06:09Alex NeundorfResolutionno change required => reopened
2011-11-01 06:10Alex NeundorfNote Added: 0027693
2011-11-01 06:10Alex NeundorfStatusfeedback => closed
2011-11-01 06:10Alex NeundorfResolutionreopened => no change required

Notes
(0027691)
Alex Neundorf   
2011-11-01 06:09   
Simply setting the CC and CXX environment variables to the gcc and g++ you want to use before the initial cmake/ccmake/cmake-gui run should do what you want, there should be no need for a toolchain file (also since this takes you into cross-compiling mode, which makes things more complicated).

CC=/usr/bin/gcc-4.5 CXX=/usr/bin/g++-4.5 ccmake ../src

should do it.

Alex
(0027692)
Alex Neundorf   
2011-11-01 06:09   
Feel free to reopen the issue if this doesn't work for you.
(0027693)
Alex Neundorf   
2011-11-01 06:10   
...closing again (was just reopened to add a note).