[Cmake] Combining Separate CMake Projects

Chris Scharver scharver at evl.uic.edu
Mon Jun 28 11:30:51 EDT 2004


On Jun 28, 2004, at 9:06 AM, Brad King wrote:

> Chris Scharver wrote:
>
>> 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.
>
> As far as I know there is currently no way to do this short of setting 
> up the build system to copy the library source directories into a 
> subdirectory of the application.  What you want to do is easily 
> accomplished by creating a single CMakeLists.txt file in the directory 
> above all three source trees.  Doing this will allow the whole thing 
> to be built as one application, but you will still be able to point 
> cmake to one of the subdirectories to build it individually.

I did try this approach, and it worked perfectly. There is one extra 
directory layer, so maybe I should finally add a CUSTOM_COMMAND to 
install the resulting executable into the original source directory. 
That way, the end user doesn't have to care about how many directory 
layers are in place during the build as long as the executable is in 
the correct location relative to the data files. CUSTOM_COMMAND is 
still the only way to perform a target install for Visual Studio 
workspaces, correct?

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