CMake C++ & Eclipse CDT
I'm just trying a very nice build system wrapper that is based on CMake and Python for C/C++ projects. The nice thing about it is, that it supports external dependencies and offers dozens of cross-compilation options. And as if that wouldn't be enough, it offers a lot of nice CMake stuff that makes your life a lot easier.
While I tried this project (which is btw. called fips - and is available here), I noticed a problem with the Eclipse indexer about C++ headers. CMake generates proper entries for all my dependency include paths, but not for the compiler native include paths. Here is now something that fixed it for me:
Go to Project -> Properties -> C/C++ General -> Preprocessor Include Paths, Macros etc -> Providers. Active the "CDT GCC Built-in Compiler Settings" option here.
You might need to reindex your project.
Other than that, I noticed, that some C++11 stuff wasn't properly handled even after that include. You can fix that on a CMake level by adding this to your CMakeLists.txt:
Unfortunately this doesn't fix everything, I still had to change the definition __cplusplus
Go to Project -> Properties -> C/C++ Include Paths and Symbols and change it here to something bigger or equals to 201103L
After I executed these steps, I could easily use Eclipse in combination with fips/CMake.
But keep in mind to do the first step again after you regenerated your Eclipse project with CMake in the later steps.
While I tried this project (which is btw. called fips - and is available here), I noticed a problem with the Eclipse indexer about C++ headers. CMake generates proper entries for all my dependency include paths, but not for the compiler native include paths. Here is now something that fixed it for me:
Go to Project -> Properties -> C/C++ General -> Preprocessor Include Paths, Macros etc -> Providers. Active the "CDT GCC Built-in Compiler Settings" option here.
You might need to reindex your project.
Other than that, I noticed, that some C++11 stuff wasn't properly handled even after that include. You can fix that on a CMake level by adding this to your CMakeLists.txt:
if (${CMAKE_EXTRA_GENERATOR} MATCHES "Eclipse CDT4") set(CMAKE_CXX_COMPILER_ARG1 -std=c++11) set(CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT TRUE) set(CMAKE_ECLIPSE_VERSION 4.2) endif()
Unfortunately this doesn't fix everything, I still had to change the definition __cplusplus
Go to Project -> Properties -> C/C++ Include Paths and Symbols and change it here to something bigger or equals to 201103L
After I executed these steps, I could easily use Eclipse in combination with fips/CMake.
But keep in mind to do the first step again after you regenerated your Eclipse project with CMake in the later steps.
Kommentare
Kommentar veröffentlichen