[CMake] Preserve tree structur for IDEs

2010-07-01 Thread Diablo 666

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?

Best regards,
Andreas
  
_
http://redirect.gimas.net/?n=M1007xIMFreunde3
Echte Freunde sagen's per Messenger!___
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

Re: [CMake] Preserve tree structur for IDEs

2010-07-01 Thread Eric Noulard
2010/7/1 Diablo 666 :
> 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


Re: [CMake] Preserve tree structur for IDEs

2010-07-02 Thread Diablo 666

Hi,

> Date: Thu, 1 Jul 2010 15:03:13 +0200
> Subject: Re: [CMake] Preserve tree structur for IDEs
> From: eric.noul...@gmail.com
> To: thediablo...@hotmail.de
> CC: cmake@cmake.org
> 
> 
> For "grouping" source in Visual Studio you may use
> 
> source_group(name [REGULAR_EXPRESSION regex] [FILES src1 src2 ...])
> 

thanks a lot! Works very fine after a few tries.

I discovered one little problem: CMake automatically generates the folders 
"Source files" and "Header files" for source/header files that are not 
explicitly put into another folder. If one creates a folder "Source files" 
explicitly via source_group, one gets a broken Visual Studio solution file.

Best regards,
Andreas
  
_
http://redirect.gimas.net/?n=M1007xHMTL4
Künftig E-Mails über Hotmail ohne Werbung versenden!___
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

Re: [CMake] Preserve tree structur for IDEs

2010-07-02 Thread Bo Thorsen

Den 02-07-2010 10:36, Diablo 666 skrev:

Hi,

 > Date: Thu, 1 Jul 2010 15:03:13 +0200
 > Subject: Re: [CMake] Preserve tree structur for IDEs
 > From: eric.noul...@gmail.com
 > To: thediablo...@hotmail.de
 > CC: cmake@cmake.org
 >
 >
 > For "grouping" source in Visual Studio you may use
 >
 > source_group(name [REGULAR_EXPRESSION regex] [FILES src1 src2 ...])
 >

thanks a lot! Works very fine after a few tries.

I discovered one little problem: CMake automatically generates the
folders "Source files" and "Header files" for source/header files that
are not explicitly put into another folder. If one creates a folder
"Source files" explicitly via source_group, one gets a broken Visual
Studio solution file.


This sounds like a bug that should be reported. Can you make a small 
self contained example and report it in the cmake bug tracker? Sending a 
mail about it tends to mean it's forgotten later.


Bo Thorsen.
Monty Program AB.

--

MariaDB: MySQL replacement
Community developed. Feature enhanced. Backward compatible.
___
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