[CMake] Add subdir and library in CmakeList.txt

Jonick, Kathy-P57450 Kathleen.Jonick at gdc4s.com
Fri Sep 23 15:06:17 EDT 2005


> 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.
> 
> Thanks!
> 
> Kathy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20050923/8b8ce367/attachment.htm


More information about the CMake mailing list