[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cmake
Subject:    [CMake] build directories, subdirs and lib dependencies
From:       Nick Arini <n.arini () btinternet ! com>
Date:       2004-12-23 13:29:06
Message-ID: 41CAC822.2000804 () btinternet ! com
[Download RAW message or body]

Dear CMake users,

I have a source directory structure with a root directory containing a 
top level CMakeLists.txt file and some code to build a front end 
executable. I also have a couple of sub directories which contain 
libraries which are required to link to the executable in the top level 
directory for the program to function correctly. I would like to step 
into each of these subdirs in turn (the libraries themselves have 
interdependencies) and build each library then build the front end 
executable and link the libraries.

In my top level CMakeLists.txt file I first step into the subdirs for 
each library in turn:


#-----------------------------------------------------------------------------
# Dispatch the build into the pre-requesit component subdirectories.

# Utility libraries and executables.
SUBDIRS(Common)

# Wrapper library
SUBDIRS(Wrappers)

#Plugin library
SUBDIRS(Plugins)


In each sub directory I have a CMakeLists.txt file which lists the 
sources and creates the library:


# Build the library
ADD_LIBRARY(vtkdCommon ${VTKDCommon_SRCS})


I then go back to the main CMakeLists.txt file and add the sources for 
the front end executable then add the executable and finally link the 
libraries:


# Create the executable
ADD_EXECUTABLE(vtkdesigner ${VTKDFront_SRCS})

# Link in the appropriate libraries
TARGET_LINK_LIBRARIES(vtkdesigner vtkdCommon vtkdWrappers CVtkDefault 
vtkCommon vtkGraphics)


The problem is when I run ccmake to configure the Makefile I get the 
following cmake error report:


Library vtkdCommon is defined using ADD_LIBRARY after the library is 
used using TARGET_LINK_LIBRARIES for the target vtkdesigner. This
breaks CMake's dependency handling. Please fix the CMakeLists.txt file.

Library vtkdWrappers is defined using ADD_LIBRARY after the library is 
used using TARGET_LINK_LIBRARIES for the target vtkdesigner. This
breaks CMake's dependency handling. Please fix the CMakeLists.txt file.

Library CVtkDefault is defined using ADD_LIBRARY after the library is 
used using TARGET_LINK_LIBRARIES for the target vtkdesigner. This
breaks CMake's dependency handling. Please fix the CMakeLists.txt file.


How do I get CMake to build the libraries first then link to the 
executable (in actual fact if you ignor the error and build anyway it 
does the right thing!)?

Many thanks and a merry Christmas.

Nick





[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic