The following issue has been SUBMITTED.
======================================================================
https://cmake.org/Bug/view.php?id=15984
======================================================================
Reported By: Thiago
Assigned To:
======================================================================
Project: CMake
Issue ID: 15984
Category: CMake
Reproducibility: always
Severity: minor
Priority: normal
Status: new
======================================================================
Date Submitted: 2016-02-23 11:00 BRT
Last Modified: 2016-02-23 11:00 BRT
======================================================================
Summary: "Eclipse CDT4 - Unix Makefiles" does not include
subprojects source dir in the Eclipse projects
Description:
Assuming 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 Information:
It is a great addition to https://cmake.org/Bug/view.php?id=12579 as well
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
2016-02-23 11:00 Thiago New Issue
======================================================================
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers