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:rau...@vr.rwth-aachen.de> rau...@vr.rwth-aachen.de
   <http://www.vr.rwth-aachen.de> www.vr.rwth-aachen.de

 

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to