QtCreator autocompletion with CMakeLists.txt and external library
-
Dear Qt forum
Since some months I'm using QtCreator 3.6.0 in combination with c++ and cmake/CMakeLists.txt
I love that it is so easy to use but spent many hours to get autocompletion working within QtCreator and was still not able to achieve autocompletion when including an external library.
The header files are not found when including them like#include <external/library/header.h>
. And therefore the the autocompletion is not working.The library is linked with the project within the CMakeLists.txt and the project builds! But no autocompletion/found headers.
Here my CMakeLists.txt. Marked the lines where I include the external library with
-->
, i.einclude_directories()
andtarget_link_libraries()
:cmake_minimum_required(VERSION 2.8.3) project(line_tracking) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") find_package(catkin REQUIRED COMPONENTS roscpp ) catkin_package() include_directories( include ${catkin_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR} --> /absolute/path/to/library/include ) add_library(myLibrary src/SomeClasses.cpp ) target_link_libraries(myLibrary ${catkin_LIBRARIES} --> /absolute/path/to/external/library.so ) add_executable(${PROJECT_NAME} src/line_tracking.cpp ) target_link_libraries(${PROJECT_NAME} myLibrary)
What kind of path or variable to I have to set for QtCreator in the CMakeLists.txt that the header files from the external library are found when including them like:
#include <external/library/header.h>
And therefore the autocompletion is working?Thank you very much for your help.
Best regards, Jonas
-
I am having the same problem, this time with QtCreator 4.1.0. Did you ever find a solution?