[CMake] CDT4 generator: source path configured incorrectly
Simon Barner
barner at gmx.de
Wed Aug 17 06:39:42 EDT 2011
Dear list,
I use CMake 2.8.5 to generate Eclipse CDT4 projects (Eclipse Helios SR2
for C/C++ developers, CDT with mingw makefiles) on Windows 7 (32 bit).
Since 2.8.5, for each project that is added using add_subdirectory(), a
linked resource is created which enables me to easily navigate to files
of subprojects.
However, the source path for my linked subproject seems to be incorrect
since I get the following warnings (see below for a test case).
Invalid project path: Missing project folder or file \test at build\test
for source path
Invalid project path: Missing project folder or file \test at build\sub
for source path
Unfortunately, this seems to prevent the Eclipse indexer from correctly
picking up the files in my subprojects.
I had a look at the generated .cproject, and here the following path
entries are generated:
<pathentry kind="src" path="[Source directory]"/>
<pathentry kind="src" path="/sub"/>
<pathentry kind="src" path="/test"/>
When I manually modify the generated .cproject file to match the actual
virtual folders the warnings go away and the index works correctly:
<pathentry kind="src" path="[Source directory]"/>
<pathentry kind="src" path="[Subprojects]/sub"/>
<pathentry kind="src" path="[Subprojects]/test"/>
Please note, it also possible to simply add the virtual [Subprojects]
folders as a path entry:
<pathentry kind="src" path="[Source directory]"/>
<pathentry kind="src" path="[Subprojects]"/>
Here is my test case:
Directory layout:
project
project/test/CMakeLists.txt
project/test/sub/CMakeLists.txt
project/build
project/test/CMakeLists.txt:
--
project(test)
add_subdirectory(test)
--
project/test/sub/CMakeLists.txt:
--
project(sub)
--
I configured an out-of-source build to project/build which I imported
into Eclipse.
Can somebody confirm this behavior? Any help would be very much appreciated.
Thanks in advance,
Simon
More information about the CMake
mailing list