2010/7/1 Diablo 666 <thediablo...@hotmail.de>:
> Hi,
>
> I need CMake to create a Visual Studio solution for a project with several
> subdirectories but only one single library.
> How can I achieve project files that preserve this tree structure?

For "grouping" source in Visual Studio you may use

source_group(name [REGULAR_EXPRESSION regex] [FILES src1 src2 ...])

concerning "several subdir" for one lib, you may have a single CMakeLists.txt
the parent subdir which add_library from subdirs.
Say you tree is :

parent/subdir1
           /subdir2


the parent/CMakeLists.txt may contains

set(SRC_DIR1 subdir1/blah.cc subdir1/bouh.cc)
set(SRC_DIR2 subdir2/how.cc subdir2/how.hh)

add_library(whatever ${SRC_DIR1} ${SRC_DIR2})

You may add source group too:

source_group(LookHere\\SDIR1 FILES ${SRC_DIR1})
source_group(LookHere\\SDIR2 FILES ${SRC_DIR2})


-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
_______________________________________________
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