[cmake-developers] [CMake 0015102]: Eclipse CDT generator produces incorrect CDT indexer configuration when calling with any custom compiler switches

Mantis Bug Tracker mantis at public.kitware.com
Sat Aug 23 04:52:27 EDT 2014


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=15102 
====================================================================== 
Reported By:                David Pajak
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15102
Category:                   CMake
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2014-08-23 04:52 EDT
Last Modified:              2014-08-23 04:52 EDT
====================================================================== 
Summary:                    Eclipse CDT generator produces incorrect CDT indexer
configuration when calling with any custom compiler switches
Description: 
Hi Guys,

I found a problem with Eclipse CDT project generator. Specifically, the CMake is
unable to create a completely filled include/symbol list for the CDT indexer
when using GCC flags that modify the built-in preprocessor symbol list. Examples
are "-std=c++11" (enable C++11 support) or "-msse4.1" (enable SSE4.1 SIMD
instruction set). I wrote a self-containing example that exposes the issue.

For some reason, CMake does not add compile options that I specify through
target_compile_options() to the argument list for the GCC symbol query call. It
does however include the definitions added via add_definitions(). I think this
should be fixed. 

One way to walk around it is to pass the compiler flags to GCC via
CMAKE_CXX_COMPILER_ARG1 which is used during symbol query. But this is A) hacky
B) seem to affect all other files in the project C) only allows to specify *a
single* compiler switch. The C) is particularly weird... 

Steps to Reproduce: 
1. Download the archive attached to the bug report
2. Set up an Eclipse project in the directory where CMakeLists.txt is, e.g.,
"cmake -G"Eclipse CDT4 - Unix Makefiles" -DCMAKE_BUILD_TYPE=Release
-DCMAKE_ECLIPSE_VERSION=4.3"
3. Import the project to Eclipse
4. Look at the indexer failing in two main points:
A) Unrecognized std::function<> -- this template is in C++11 -- it is not
visible because CMake does not pass -std=c++11 to the compiler when dumping the
preprocessor variables for the indexer. 
B) Unrecognized SIMD intrinsics despite #include <smmintrin.h> -- same as above
-- "-msse4.1" switch has not been passed to the compiler during query. The
indexer is missing (normally automatically generated) __SSE4__, __SSE4_1__,
__SSSE3__, __SSE3__ keywords, and cannot correctly include header with
intrinsics.

Both problems are also exposed when inspecting what symbols were actually
imported when creating the project. See "C/C++ Include Paths and Symbols" in
Project properties...


Additional Information: 
I use Eclipse Luna (4.4), but I don't think it really matter for this bug.


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

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2014-08-23 04:52 David Pajak    New Issue                                    
2014-08-23 04:52 David Pajak    File Added: test.tar.bz2                     
======================================================================



More information about the cmake-developers mailing list