Bug 238456 - Wrong order processing add_subdirectory
Summary: Wrong order processing add_subdirectory
Alias: None
Product: kdevelop
Classification: Applications
Component: Build tools: CMake (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
Depends on:
Reported: 2010-05-22 04:13 UTC by Nicolás Alvarez
Modified: 2017-03-04 00:01 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Note You need to log in before you can comment on or make changes to this bug.
Description Nicolás Alvarez 2010-05-22 04:13:16 UTC
Version:           4.0.60 (using KDevPlatform 1.0.60) (using 4.4.3 (KDE 4.4.3), Debian packages)
OS:                Linux (x86_64) release 2.6.32-3-amd64

There is a significant difference between CMake and KDevelop's parser in the order subdirectories are parsed.

Here is a very simple testcase that shows the wrong behavior:

message(STATUS "before")
message(STATUS "after")

message(STATUS "this is the subdir")

CMake 2.8.1 output:
-- before
-- this is the subdir
-- after

KDevelop 4.0 output:
message: ("before")
message: ("after")
message: ("this is the subdir")

CMake parses subdirectories immediately upon seeing add_subdirectory, while KDevelop seems to put the directory in a pending queue, and only after it's done processing the current dir, it processes the queue.
Comment 1 Nicolás Alvarez 2011-07-20 02:09:59 UTC
I just found that (in official CMake) SUBDIRS() does add dirs to a queue to process them later, while ADD_SUBDIRECTORY() processes the subdir immediately. So the current KDevelop behavior for SUBDIRS is correct.
Comment 2 Aleix Pol 2017-03-04 00:01:27 UTC
We are not processing directories anymore