[CMake] Visual Studio folders

Armin Berres trigger at space-based.de
Sun Feb 15 17:40:38 EST 2009


On Sun, 15 Feb 09 15:15, Michael Jackson wrote:
> 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 also use regular expressions if you want. E.g.
source_group("robocup" REGULAR_EXPRESSION "robocup/src/[^/]+$")

It's a bit sad, that 
source_group("" REGULAR_EXPRESSION "src/[^/]+$")
doesn't place source and header in the root of the project, but again in
the header and source folders. See [0]

Greetings,
Armin

[0] http://www.cmake.org/Bug/view.php?id=8163


More information about the CMake mailing list