[CMake] Making a Top Level CMakeLists File and Dependant libraries

Mike Jackson imikejackson at gmail.com
Fri Aug 18 11:29:07 EDT 2006


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?

In my subprojects I have lines like this to find dependent libraries:

# ------------ Find FoxCore Library ----------------------
FIND_LIBRARY (FOXCORE_LIBRARY FoxCore
	${PROJECT_SOURCE_DIR}/../../Bin/${CMAKE_BUILD_TYPE}
)

# ------------ Find FoxView Library ----------------------
FIND_LIBRARY (FOXVIEW_LIBRARY FoxView
	${PROJECT_SOURCE_DIR}/../../Bin/${CMAKE_BUILD_TYPE}
)

I am assuming I need a different syntax or something. I tried looking
in the VTK CmakeLists.txt files but those files are so involved that I
can not really learn anything. So could someone point me in the right
direction? I have the Cmake 2.2 book and am leafing through it to try
and figure something out.


Thanks
-- 
Mike Jackson
imikejackson _at_ gee-mail dot com


More information about the CMake mailing list