Bug 189597 - CMake doesn't follow ADD_SUBDIRECTORY macro and compile dependencies first.
Summary: CMake doesn't follow ADD_SUBDIRECTORY macro and compile dependencies first.
Status: RESOLVED UPSTREAM
Alias: None
Product: unknown
Classification: Bugzilla Internals
Component: general (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-14 10:51 UTC by Gajendra Kashyap
Modified: 2009-04-14 11:13 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gajendra Kashyap 2009-04-14 10:51:07 UTC
Version:           2.4, 2.6.3 (using KDE 3.5.10)
Compiler:          GNU GCC 4.1.2 Problem is independent of compiler version
OS:                Linux
Installed from:    SuSE RPMs

I'm using CMake on Suse 10.1 and 11.1 to build two projects:
1. QT4 applications 
2. ACE+TAO application

In both the cases the common thing is that some files are generated at run time.
1. QT: ui_xyz.h, moc_xyz.cxx
2. ACE+TAO: *_S.h,*_S.i, *_S.cpp, *_C.h, *_C.i, *_C.cpp etc.

Qt Problem: 
Create a simple application with a main window and a separate dialog box. Do the gui design with Qt designer to get a ui file. This is important because in absence of multiple ui.h the problem is not observed.
Write the main window code such that the dialog (created with Qt designer) opens on clicking a button or menu.

The directory structure is

 Project --- Main.cpp and CMakeLists.txt
  |
   ---- MainWindow ---> CMakeLists.txt and Sources +
                        MainWindow ui file
  |
   ---- Dialog ---> CMakeLists.txt and Sources + 
                    Simple dialog ui file

Now write a CMake for Qt4 such that MainWindow and Dialog create their own libs which are linked to exe in the main CMakeLists.txt.

In this project without the use of ADD_DEPENDENCIES (mainwindow dialog) in the CMake of MainWindow the Dialog sources are not compiled to create a Dialog lib. The build fails.

The CMake appears to jump the ADD_SUBDIRECTORY and go to the MainWindow without compiling the dependency Dialog.

ACE+TAO IDL problem:
A behavior similar with Qt is observed here also. CMake appears to disobey the ADD_SUBDIRECTORY command and jumps to some other place. For server and client implementation we need the IDL generated sources, which CMake fails to generate at runtime.
Somehow I got it working using ADD_DEPENDENCIES.

Note that this behavior of CMake system is observed when some sources are generated at runtime and there is a dependency on them as described above.

I don't thinkthat every time we should resolve to using ADD_DEPENDENCIES for a forceful build. I expect that CMake should follow the compilation order as listed by ADD_SUBDIRECTORY and not miss the dependency compilation.

Thanks
Comment 1 Pino Toscano 2009-04-14 11:12:34 UTC
Sorry, but we do not develop the CMake build system.
Please report your problem to the CMake bug tracking system, see http://www.cmake.org