[CMake] Using source_group in projects with sub directories
Dominik Rausch
rausch at vr.rwth-aachen.de
Thu Feb 3 10:48:19 EST 2011
Hi
We currently have a project with multiple subdirectories, and want to use a
structure where the top-level CmakeLists.txt only needs to know its subdirs,
and not what files/subdirs/sourcegroups are defined in these subfolders. The
CmakeList.txt’s would look something like this
Top-level cmake file
set( dirFiles a.h a.cpp )
set( allFiles ${dirFiles} )
source_group( "sourcegroup" FILES ${dirFiles} )
add_subdirectory( subdir )
add_library( MyLib ${allFiles} )
set( relDir "subdir" )
Subdir cmake file
set(localFiles b.h b.cpp)
foreach( file ${localFiles} )
list( APPEND localFullDirFiles "${relDir}/${file}" )
list( APPEND allFiles "${relDir}/${file}" )
endforeach( file )
source_group( "anothersourcegroup" FILES localFiles )
set( allFiles ${allFiles} PARENT_SCOPE )
However, in this case the files from the subdir are not affected by the
subgroup (neither are they if they are written relative to the subdir, i.e.
without the relDir prefix).
Is it necessary to use the source_group command in the same file as the
add_library command? Or is there any other way to get it working?
Regards and Thanks
Dominik
--
Dipl.-Inform. Dominik Rausch
Virtual Reality Group, RWTH Aachen University
Lehrstuhl für Informatik 12 (Hochleistungsrechnen)
Rechen- und Kommunikationszentrum
Seffenter Weg 23, 52074 Aachen
Tel. +49 241 80 29732
<mailto:rausch at vr.rwth-aachen.de> rausch at vr.rwth-aachen.de
<http://www.vr.rwth-aachen.de> www.vr.rwth-aachen.de
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110203/0475ed98/attachment.htm>
More information about the CMake
mailing list