[Cmake] Combining Separate CMake Projects

Chris Scharver scharver at evl.uic.edu
Sat Jun 26 14:57:26 EDT 2004


Hi,

I have several CMake-configurable directories. They're primarily used 
for stand-alone libraries, and then I have a final application that 
uses all the libraries. When I build the application, I want to combine 
the separate CMake projects together into a single build directory. The 
directory structure is as follows (... indicates source files):

library1/
	CMakeLists.txt
	...
library2/
	CMakeLists.txt
	...
application/
	CMakeLists.txt
	data/
	source/
		CMakeLists.txt
		...

I have been building each library separately, and then I build the 
application pointing it toward the libraries' include and build 
directories. What I want to do is create the build relative to the 
application directory. Currently, I'm doing this using 
SUBDIRS(../library1 ../library2 source). However, when I build, this 
creates the incorrect build directory structure. The libraries' object 
directories are parallel to application's build directory. I get this:

build/
	source/
library1/
library2/

What I want is this:

build/
	library1/
	library2/
	source/

Is there something that I could use other than SUBDIRS? The libraries 
can stand alone, but I want to compile such that building the 
application ensures that the libraries are built within the build 
directory. Is there something akin to SUBDIRS that will allow me to 
import another CMake project? I noticed that I cannot use an absolute 
path in the SUBDIRS command, but that seems exactly what I want to be 
able to do. FIND_PACKAGE doesn't seem to be quite what I'm looking 
for--I want everything built from one CMake run without having to go 
through several CMake-configure-build cycles for each directory. Any 
help would be much appreciated.

Thanks,
Chris

--
Chris Scharver
Electronic Visualization Laboratory
The University of Illinois at Chicago
Ph: 312-996-3002   FAX: 312-413-7585
<http://www.evl.uic.edu/scharver/>



More information about the Cmake mailing list