[CMake] Making a Top Level CMakeLists File and Dependant libraries
Brad King
brad.king at kitware.com
Fri Aug 18 11:34:02 EDT 2006
Mike Jackson wrote:
> I am trying to create a Top level Cmakelists.txt file to build my
> project. My project is laid out kinda like vtk in that we have
> subfolders with base libraries to be built in a specific order.
>
> I have the first few lines in this top level cmake file to be:
>
>
> SUBDIRS (
> Fox/Core
> Fox/Views
> Fox
> )
>
> So I run cmake on the top level directory and I get some errors that say:
>
> CMake Error: This project requires some variables to be set,
> and cmake can not find them.
> Please set the following variables:
> FOXCORE_LIBRARY
> FOXVIEW_LIBRARY
>
>
> All those are libraries that are built during the build process so of
> course with a clean build cmake can not find them because they are not
> built yet. So, how do I tell cmake that those libraries will be there?
You don't need to find libraries built by CMake in the same project.
Just reference them by their logical target name:
# Fox/Core/CMakeLists.txt
ADD_LIBRARY(FoxCore ...)
# Fox/CMakeLists.txt
ADD_EXECUTABLE(Fox ...)
TARGET_LINK_LIBRARIES(Fox FoxCore)
-Brad
More information about the CMake
mailing list