[CMake] Visual Studio folders

Michael Jackson mike.jackson at bluequartz.net
Sun Feb 15 15:15:36 EST 2009


While I don't think you can group a set of targets into a folder in VS  
you _can_ add the headers into the folders of each target so that they  
show up in each VS project within the solution file.


Two things are needed: 1) Add the headers to the target and 2) use the  
"source_group" command to group them together.

This should work.

set(LIB1_SRCS MyLibrary1.h MyLibrary1.cpp )
source_group(Library1 FILES ${LIB1_SRCS} )
add_library(MyLibrary1 ${LIB1_SRCS})

You can repeat this for each "sub project" within your main project.

Although it does NOT completely answer your question it may help out  
the usability. It did for my project.

_________________________________________________________
Mike Jackson                  mike.jackson at bluequartz.net
BlueQuartz Software                    www.bluequartz.net
Principal Software Engineer                  Dayton, Ohio



On Feb 15, 2009, at 2:46 PM, Andrew J Roark wrote:

> Hello,
>
> The following pertains to Visual Studio 2008 (FWIW) and a very recent
> (not sure exactly which) build of cmake.
>
> Firstly, I'm a big cmake fan. We had lots of discussions where I work
> on which tool to move to. We trialled scons and others and settled on
> cmake.
> Thanks for the great tool. :)
>
> It works very well on Linux for us and the windows builds are good,
> BUT the usage on windows has some frustrations (though the build
> itself works).
>
> Firstly, all the *.cpp source is clearly available under "Source
> Files", I can't get the *.h files to appear under "Header Files". I've
> tried a few things based on googling and the cmake wiki and nothing
> seems to work.
>
> The project in question has about 20 libraries and 5 executables. That
> may be confusing the cmake generation stage.
>
> The targets load and build, but the large number of targets makes
> usage cumbersome. It would really help to group them into folders like
> "Communcations", "Tests", "Samples", "Production" etc.
> I can't see a way to targets into a folder. Am I missing something?
>
> Thanks for any advice!
> AJ
> _______________________________________________
> 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



More information about the CMake mailing list