Community
Participate
Working Groups
I encountered this problem while converting a pretty big project to cmake. It seems that if the file is not part of some cmake target, then it is indexed using default (?) include paths (include_directories directive from CMakeLists.txt is ignored). It is not a problem (well, not a big problem - its still annoying to see lots of yellow and red warning/error markers), unless this file is a header included from various .cpp files - some of them not being part of a build. It seems that if the header was first encountered by indexer while indexing a file that is not part of the build, then it will not see proper include paths. Here are the steps I performed to test this: 1. Create new CMake project and modify CMakeLists.txt: cmake_minimum_required (VERSION 2.6) project (testyy) # external include directory include_directories ( /opt/poco-1.8.1/include) add_executable(testyy testyy.cpp ) 2. Add 3 files testyy.cpp: #include <iostream> #include <Poco/Timestamp.h> using namespace std; struct Test { Poco::Timestamp ts; }; int main(int argc, char **argv) { cout << "Hello world"; return 0; } ------------------- foo.cpp #include "bar.h" void foo() {} ------------------- bar.h #ifndef BAR_H__ #define BAR_H__ #include <Poco/Timestamp.h> // warning - include not found struct Bar { Poco::Timestamp ts; // error - Poco::Timestamp could not be resolved }; #endif After building the project - Poco/Timestamp is properly found and resolved in testyy.cpp, but not in bar.h Adding foo.cpp to the build target "fixes it", but its rather not "practical" in my project to add absolutely all .cpp files (some of them being Linux, other Windows or Android code). It would be best to exclude files that are not part of the build from indexer, but setting this option in Preferences seems to disable indexer completely for all files.