MantisBT - CMake
View Issue Details
0013619CMakeCMakepublic2012-10-30 13:152013-03-04 08:38
Michael Bachmann 
 
highmajoralways
closedno change required 
amd64Redhat Linux4.0
 
CMake 2.8.10CMake 2.8.10 
0013619: cmake 2.8.10-rc3: gcc which is placed in PATH is not used but the system compiler
e.g.: gcc 4.5.2 executable is situated under:
/opt/gcc-4.5.2/bin/gcc

gcc 3.4.6 executable is situated under:
/usr/bin/gcc

the PATH environment variable is set as follows:
export PATH=/opt/gcc-4.5.2/bin:/usr/bin:$PATH

=> executing "which gcc" prints "/opt/gcc-4.5.2/bin/gcc"
Using cmake (2.8.10-rc3) gcc 3.4.6 is configured when executing:
cmake ../mysrc

Using cmake-gui (2.8.10-rc3) gcc 4.5.2 is configured when executing:
cmake-gui ../mysrc


In previous releases cmake and cmake-gui used both gcc 4.5.2 during configuration (the gcc executable which is found first via the PATH variable)
No tags attached.
Issue History
2012-10-30 13:15Michael BachmannNew Issue
2012-10-30 13:25Brad KingNote Added: 0031351
2012-10-31 05:27Michael BachmannNote Added: 0031354
2012-10-31 07:30Brad KingNote Added: 0031356
2012-10-31 07:30Brad KingStatusnew => resolved
2012-10-31 07:30Brad KingResolutionopen => no change required
2012-10-31 10:52David ColeFixed in Version => CMake 2.8.10
2012-10-31 10:52David ColeTarget Version => CMake 2.8.10
2013-03-04 08:38Robert MaynardNote Added: 0032494
2013-03-04 08:38Robert MaynardStatusresolved => closed

Notes
(0031351)
Brad King   
2012-10-30 13:25   
I think you've encountered this change:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7e58e5bb [^]

which was intentional as detailed in the commit message.

However, I cannot reproduce any selection difference between cmake and cmake-gui. What is the output from CMake in each case? I'm looking for output like:

 -- The C compiler identification is GNU 4.7.1
 -- Check for working C compiler: /usr/bin/cc
 -- Check for working C compiler: /usr/bin/cc -- works

from the command-line tool and in the configuration log window of cmake-gui.
(0031354)
Michael Bachmann   
2012-10-31 05:27   
OK. This is not a bug.

No, I have not encountered this change yet and it is very unexpected. But it makes sense now.

The output is:
-- The C compiler identification is GNU 3.4.6
-- The CXX compiler identification is GNU 3.4.6
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
...
for both: cmake-gui and cmake.

So: When setting explicitly the environment variables CC and CXX:
$ export CC=/opt/gcc-4.5.2/bin/gcc
$ export CXX=/opt/gcc-4.5.2/bin/c++

cmake and cmake-gui use gcc 4.5.2 like before:
-- The C compiler identification is GNU 4.5.2
-- The CXX compiler identification is GNU 4.5.2
-- Check for working C compiler: /opt/gcc-4.5.2/bin/gcc
-- Check for working C compiler: /opt/gcc-4.5.2/bin/gcc -- works
...

Another way to explicitly use gcc 4.5.2 is using the command line option "-D" to explicitly define the compiler paths:
cmake -DCMAKE_C_COMPILER:FILEPATH=/opt/gcc-4.5.2/bin/gcc -DCMAKE_CXX_COMPILER:FILEPATH=/opt/gcc-4.5.2/bin/c++

But this works only with the cmake executable...

Thank you for your help!
(0031356)
Brad King   
2012-10-31 07:30   
Thanks for reporting back!
(0032494)
Robert Maynard   
2013-03-04 08:38   
Closing resolved issues that have not been updated in more than 4 months.