[CMake] Add subdir and library in CmakeList.txt

Jonick, Kathy-P57450 Kathleen.Jonick at gdc4s.com
Fri Sep 23 18:16:26 EDT 2005


File1.c is location in the current directory.  But it is looking in the
directory listed in the SUBDIRS command.  I wanted it to build those
directories, then create the library in the current directory.  

Thanks!

Kathy

-----Original Message-----
From: William A. Hoffman [mailto:billlist at nycap.rr.com] 
Sent: Friday, September 23, 2005 12:09 PM
To: Jonick, Kathy-P57450; cmake at cmake.org
Subject: Re: [CMake] Add subdir and library in CmakeList.txt


>
>Is it possible to include a SUBDIR list as well as a library in one
CMakeList.txt file? 
>
>I want to be able to build a library in the current directory, as well
as call the CMakeList.txt file in 2 subdirectories.  My CMakeList.txt
file looks like: 
>SUBDIRS(dir1 dir2)
>
>SET(SOURCES <file list> )
>
>ADD_LIBRARY(libname SHARED ${SOURCES})
>
>But when I run cmake, I get messages looking for the files listed in
the subdirectories, rather than the current directory: 
>CMake Error: can not find file 
>/home/cmake_demo/current_dir/dir1/file1.c
>
>Tried .c .C .c++ .cc .cpp .cxx .m .M .mm .h .h++ .hm .hpp .hxx .in .txx
>
>Is this possible?  If not, how do I build the library in current dir?
How do I say I also want to build subdirectories?  I tried using the
PREORDER flag in the SUBDIRS statement since I want to build those
first, that that didn't seem to help at all.

This is certainly possible.   Where is file1.c added?  Could the error
be in one of the sub dirs?

-Bill



More information about the CMake mailing list