MantisBT - CMake
View Issue Details
0012155CMakeCMakepublic2011-05-04 18:592011-05-05 13:31
saravanan 
Alex Neundorf 
normalminoralways
closedno change required 
CMake 2.8.4 
CMake 2.8.5CMake 2.8.5 
0012155: Header file list generated for CDT is missing one header
In the list of headers that GCC/ICC includes by default, CMake always leaves the last header from being included in CMAKE_ECLIPSE_CXX_SYSTEM_INCLUDE_DIRS when generating the Makefiles for Eclipse CDT4.
If the following CMakeLists.txt file
PROJECT(HELLO)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
IF("${CMAKE_EXTRA_GENERATOR}" MATCHES "Eclipse")
   MESSAGE(STATUS "Using CMake Version ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}")
   IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.6)
      INCLUDE(${CMAKE_ROOT}/Modules/CMakeFindEclipseCDT4.cmake)
      MESSAGE(STATUS "${CMAKE_ECLIPSE_CXX_SYSTEM_INCLUDE_DIRS}")
   ENDIF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.6)
ENDIF("${CMAKE_EXTRA_GENERATOR}" MATCHES "Eclipse")

the output generated looks like

-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Using CMake Version 2.8
-- /usr/include/c++/4.1.2;/usr/include/c++/4.1.2/x86_64-suse-linux;/usr/include/c++/4.1.2/backward;/usr/local/include;/usr/lib64/gcc/x86_64-suse-linux/4.1.2/include;/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/include
-- Configuring done
-- Generating done

However when the default includes are identified using "/usr/bin/g++ -v -E -x c++ -dD ~/dummy.c", the (relevant section of the) output looks like:

#include <...> search starts here:
 /usr/include/c++/4.1.2
 /usr/include/c++/4.1.2/x86_64-suse-linux
 /usr/include/c++/4.1.2/backward
 /usr/local/include
 /usr/lib64/gcc/x86_64-suse-linux/4.1.2/include
 /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/include
 /usr/include
End of search list.

It can be seen that the last header "/usr/include" is missing from being included in CMAKE_ECLIPSE_CXX_SYSTEM_INCLUDE_DIRS



In the file CMakeFindEclipseCDT4.cmake, if the regular expression in the statement
IF( "${_gccOutput}" MATCHES "> search starts here[^\n]+\n *(.+) *\n *End of (search) list" )

is changed to
IF( "${_gccOutput}" MATCHES "> search starts here[^\n]+\n *(.+ *\n) *End of (search) list" )

then the last header should probably not get ignored
No tags attached.
Issue History
2011-05-04 18:59saravananNew Issue
2011-05-05 13:29Alex NeundorfAssigned To => Alex Neundorf
2011-05-05 13:29Alex NeundorfStatusnew => assigned
2011-05-05 13:31Alex NeundorfNote Added: 0026440
2011-05-05 13:31Alex NeundorfStatusassigned => closed
2011-05-05 13:31Alex NeundorfResolutionopen => no change required
2011-05-05 13:31Alex NeundorfFixed in Version => CMake 2.8.5
2011-05-05 13:31Alex NeundorfTarget Version => CMake 2.8.5

Notes
(0026440)
Alex Neundorf   
2011-05-05 13:31   
This is already fixed in master and will be in 2.8.5 :
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6a38cab2de2a529779c18e0c3872112e3851665b [^]

Alex