View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015984CMakeCMakepublic2016-02-23 09:002016-06-10 14:31
ReporterThiago 
Assigned ToKitware Robot 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionmoved 
Platformx86_64OSLinuxOS VersionDebian 8
Product VersionCMake 3.4.3 
Target VersionFixed in Version 
Summary0015984: "Eclipse CDT4 - Unix Makefiles" does not include subprojects source dir in the Eclipse projects
DescriptionAssuming there is a project called "app1" that adds another sibling project "lib1" on its CMakeLists.txt. When calling cmake -G "Eclipse CDT4 - Unix Makefiles" to generate Eclipse projects, not only app1 project is created as the main project, but both projects are added as virtual [Subprojects], as expected.

That is great, however, only the source code of app1 is indexed by Eclipse. In order to indexing work for lib1 too, we need to manually right click the project and go to the "C/C++ Project paths" and add "[Subprojects]" or "[Subprojects]/lib1" in the Source list. That action would result in a tag being added to the .cproject:

<pathentry kind="src" path="[Subprojects]/lib1"/> is added to <storageModule moduleId="org.eclipse.cdt.core.pathentry">

It would be great if cmake added CMAKE_SOURCE_DIR of all subprojects to the parent project's .cproject during eclipse project generation
Steps To Reproduce----------------------------------------------------------------------
App1's CMakeLists.txt
----------------------------------------------------------------------
cmake_minimum_required(VERSION 3.0)
project(MyApp1)

set(CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT TRUE)

add_subdirectory("../lib1" "${CMAKE_CURRENT_BINARY_DIR}/lib1")
add_executable(app1 src/main.cpp)
target_link_libraries(app1 L1)

----------------------------------------------------------------------
Lib1's CMakeLists.txt
----------------------------------------------------------------------
cmake_minimum_required(VERSION 3.0)
project(MyLib1)

set(CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT TRUE)
add_library(L1 SHARED src/main.cpp)
target_include_directories(L1 PUBLIC
  $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
  $<INSTALL_INTERFACE:include>
)

Go to an out-of-source dir and run:
cmake -G"Eclipse CDT4 - Unix Makefiles" -DCMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT=TRUE ../../app3/

Import the project on eclipse

Try to see a lib1's function definition from app1 source code.

Only the lib1's header will be found by eclipse. lib1's function definition is not in the indexing databse and will not be found
Additional InformationIt is a great addition to https://cmake.org/Bug/view.php?id=12579 [^] as well
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0042944)
Kitware Robot (administrator)
2016-06-10 14:29

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2016-02-23 09:00 Thiago New Issue
2016-06-10 14:29 Kitware Robot Note Added: 0042944
2016-06-10 14:29 Kitware Robot Status new => resolved
2016-06-10 14:29 Kitware Robot Resolution open => moved
2016-06-10 14:29 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team