[cmake-developers] [CMake 0013606]: Eclipse Generator wants to run c++ to determine system include paths before c++ compiler is determined by cmake

Mantis Bug Tracker mantis at public.kitware.com
Thu Oct 25 08:19:04 EDT 2012


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=13606 
====================================================================== 
Reported By:                Mika Fischer
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   13606
Category:                   CMake
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2012-10-25 08:19 EDT
Last Modified:              2012-10-25 08:19 EDT
====================================================================== 
Summary:                    Eclipse Generator wants to run c++ to determine
system include paths before c++ compiler is determined by cmake
Description: 
I added some debugging output to
CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake and get the
following output from cmake -G "Eclipse CDT4 - Ninja" <srcdir>:

-------------------------------------------------------------------------
-- The C compiler identification is GNU 4.7.2
-- Could not determine Eclipse version, assuming at least 3.6 (Helios). Adjust
CMAKE_ECLIPSE_VERSION if this is wrong.
CMAKE_C_COMPILER:    "/usr/bin/gcc"
CMAKE_C_COMPILER_ID: "GNU"
Running c system include detection: /usr/bin/gcc  -v -E -x c -dD dummy
CMAKE_CXX_COMPILER:    ""
CMAKE_CXX_COMPILER_ID: ""
-- Check for working C compiler using: Ninja
-- Check for working C compiler using: Ninja -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
CMAKE_CXX_COMPILER set to "/usr/bin/c++"
-- The CXX compiler identification is GNU 4.7.2
CMAKE_CXX_COMPILER_ID set to "GNU"
-- Check for working CXX compiler using: Ninja
-- Check for working CXX compiler using: Ninja -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-------------------------------------------------------------------------

So somehow the Eclipse generator wants to determine the include paths of the 
C++ compilers before it's even detected by CMake. This works for C, since
CMAKE_C_COMPILER and CMAKE_C_COMPILER_ID are set at that point (see debug output
shown above). However this is not the case for CMAKE_CXX_COMPILER and
CMAKE_CXX_COMPILER_ID. Therefore the generator can't run the C++ compiler and
thus the project file misses the system includes for C++, breaking things
everywhere...

Steps to Reproduce: 
Generate an Eclipse project file of a C++ project.

Additional Information: 
I use the following as aworkaround:

cmake -D CMAKE_CXX_COMPILER_ID:STRING=GNU -D
CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/c++ -G "Eclipse CDT4 - Ninja"

-------------------------------------------------------------------------
-- The C compiler identification is GNU 4.7.2
-- Could not determine Eclipse version, assuming at least 3.6 (Helios). Adjust
CMAKE_ECLIPSE_VERSION if this is wrong.
CMAKE_C_COMPILER:    "/usr/bin/gcc"
CMAKE_C_COMPILER_ID: "GNU"
Running c system include detection: /usr/bin/gcc  -v -E -x c -dD dummy
CMAKE_CXX_COMPILER:    "/usr/bin/c++"
CMAKE_CXX_COMPILER_ID: "GNU"
Running c++ system include detection: /usr/bin/c++  -v -E -x c++ -dD dummy
-- Check for working C compiler using: Ninja
-- Check for working C compiler using: Ninja -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
CMAKE_CXX_COMPILER set to "/usr/bin/c++"
-- The CXX compiler identification is GNU
CMAKE_CXX_COMPILER_ID set to "GNU"
-- Check for working CXX compiler using: Ninja
-- Check for working CXX compiler using: Ninja -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-------------------------------------------------------------------------

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2012-10-25 08:19 Mika Fischer   New Issue                                    
======================================================================




More information about the cmake-developers mailing list