[Cmake] Dependency problem

Filipe Sousa filipe.gr.sousa at alunos.ipb.pt
Tue Mar 4 16:39:08 EST 2003


Hi,

I have the following directory struture in my project:

myapp/
 + banner/
     banner.h
     banner.cpp
     CMakeLists.txt
 main.cpp
 CMakeLists.txt

banner CMakeLists.txt:
ADD_LIBRARY(banner banner.cpp)

main CMakeLists.txt:
PROJECT(myapp)
SUBDIRS(banner)

LINK_DIRECTORIES(banner)
ADD_EXECUTABLE(myapp main.cpp)
TARGET_LINK_LIBRARIES(myapp banner)

When I compile the project for the first time I get the following output:
[fsousa at neptuno]$ make
Building dependencies. cmake.depends...
Building object file main.o...
Building dependencies. cmake.depends...
Building object file banner.o...
Building static library libbanner.a...
Building executable myapp...
/home/fsousa/tmp/myapp/banner: building default_target

If I change the banner.h file and compile again I get the next output:
[fsousa at neptuno]$ make
Building dependencies dependlocal...
Building object file main.o...
Building executable myapp...
/home/fsousa/myapp/test/banner: building default_target
Building dependencies dependlocal...
Building object file banner.o...
Building static library libbanner.a...

As you can see first build the executable before the libbanner.a, but the 
right order should be first create the libbanner.a and build the executable 
next.

Is this a bug or I'm missing something?

Thanks.
-- 
Filipe Sousa





More information about the CMake mailing list