As for the name, I found a lot of discussion, but, unfortunately, no correct / universal answer. You can set global inclusions for the Eclipse CDT, but if your compiler changes, you must do it again. Thus, I wrote the following working minimal example CMakeFile.txtto set the inclusions that are used by the compiler.
cmake_minimum_required(VERSION 2.8.7 FATAL_ERROR)
string (REGEX MATCH "[^/]+$" PROJECT_NAME "${CMAKE_CURRENT_BINARY_DIR}")
message (STATUS "Set PROJECT_NAME to ${PROJECT_NAME}")
project ("${PROJECT_NAME}")
execute_process(COMMAND echo COMMAND ${CMAKE_CXX_COMPILER} -Wp,-v -x c++ - -fsyntax-only ERROR_VARIABLE GXX_OUTPUT)
set(ENV{GXX_OUTPUT} ${GXX_OUTPUT})
execute_process(COMMAND echo ${GXX_OUTPUT} COMMAND grep "^\ " OUTPUT_VARIABLE GXX_INCLUDES)
include_directories(
${GXX_INCLUDES}
)
add_executable("${PROJECT_NAME}" main.cpp)
greping involves some pain in **, but it works. Another thing is that it does not work for cmake above cmake 2.8.7regarding this error http://public.kitware.com/Bug/view.php?id=15211 . So, I want to know if anyone has a better way to install the system?