Reply to topic

include directories background parser parsed

mibe.jjh
Registered Member
Posts
4
Karma
0
Hello, I'm trying to use KDevelop 5 for my project which has hierarchical CMake build system.

I have trouble with KDevelop 5's background parser now.
I used include_directories() in child CMakeLists.txt and it was compiled without any errors.
However, I still have lots of "Problems in Semantic analisys" with red underlines.

When I created another simple and small project with similar structure for a test,
there was no "Problems in semantic analisys" and Now I know kdevelop5 parses child cmakelists.txt for adding include directories.

So I'd like to know what is different between my original project and simple test project.

Is there any way to debug "background parser"'s parsing results including "include directories"?
User avatar scummos
Global Moderator
Posts
1153
Karma
7
OS
Does your project use the CMake project manager? Querying the include directories from cmake only works with that. You select the project manager when opening the project for the first time.


I'm working on the KDevelop IDE.
mibe.jjh
Registered Member
Posts
4
Karma
0
Thanks for your reply.

I'm not sure which project manager were selected because I'm migrating from kdevelop4 to kdevelop5 now.
Maybe the project file(.kdev4) coulde be generated from kdevelop4 and I imported it on Kdevelop5.
I'll open the project and select right project manager later and report the result to this thread.

Thank you again!
mibe.jjh
Registered Member
Posts
4
Karma
0
I think I found out why kdevelop couldn't parse correctly.

Because my cmake build structure is designed to include sub projects optionally as shown below,
If kdevelop parse only cmakelists.txt without cache remember which sub projects selected,
this problem will be occured.

Code: Select all
foreach(subdir ${SUBDIRS})
    if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${subdir})
        message("DIR : ${subdir}")
        if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${subdir}/src/CMakeLists.txt)
            message("CMAKE FOUND ${subdir}")
            option(WITH_${subdir} "BUILD ${subdir}" OFF)
            if(WITH_${subdir})
                add_subdirectory(${subdir}/src)
            endif()
        elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${subdir}/CMakeLists.txt)
            message("CMAKE FOUND ${subdir}")
            option(WITH_${subdir} "BUILD ${subdir}" OFF)
            if(WITH_${subdir})
                add_subdirectory(${subdir})
            endif()
        endif()
    endif()
endforeach()


As a test, I added sub directories explicitly then all red underlines were gone.

So my questions are ..
Does kdevelop use the cache when it parses cmakelists.txt?
If not, is there any solution or trick for parsing implicitly added sub directories?
User avatar scummos
Global Moderator
Posts
1153
Karma
7
OS
KDevelop should query these things from CMake. Did you configure your actual build directory as the build directory in KDevelop? Then it should also use the same configuration.

We don't really parse (at least not for this purpose) CMakeLists.txt any more.


I'm working on the KDevelop IDE.
mibe.jjh
Registered Member
Posts
4
Karma
0
Ok..

When does kdevelop query these things? when build button clicked or project loaded or background parser worked?

KDevelop may not know when I triggered "build" because I type "make" in the console.
User avatar scummos
Global Moderator
Posts
1153
Karma
7
OS
As soon as cmake (re)configures the project, as far as I'm aware. This is kind of independent of building it, configure and build are two separate steps. Does it work now?


I'm working on the KDevelop IDE.

 
Reply to topic

Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], cylverbak, funkyskywalker, Google [Bot], ineuw, Majestic-12 [Bot], maxmu, MRK0017, Sogou [Bot], sylvainrousseau, Yahoo [Bot]