[CMake] How to preserve directory structure within Visual Studio

J Decker d3ck0r at gmail.com
Thu Dec 8 16:19:24 EST 2011


set_property(GLOBAL PROPERTY USE_FOLDERS On)

SET_SOURCE_FILES_PROPERTIES( ${YOUR_SOURCES} PROPERTIES
		FOLDER "project folder name here" )


On Thu, Dec 8, 2011 at 12:32 PM, Stephen Torri <stephen.torri at gmail.com> wrote:
> CMake version: 2.8
> IDE: Visual Studio 2008
>
> For the source and header files I would like to preserve the directory
> structure within the Visual Studio "Header Files" and "Source Files"
> folders. Without it should there occur two files with the same name
> but in different directories only one is shown. For example:
>
> SET ( HEADERS
>   base_units/time.hpp
>   si/time.hpp )
>
> add_custom_target ( UnitHeaders SOURCES ${HEADERS} )
>
> If UnitHeaders is included within the parent CMakeLists.txt file a
> Project called UnitHeaders is included within the Visual Studio
> Solution. What you will see undert the "Header Files" for UnitHeaders
> is only one header file. I would like to see the following within
> Visual Studio under Header Files:
>
> UnitHeaders
>   |
>   |-- Header Files -> base -> time.hpp
>                          -> si -> time.hpp
>
> A search on Google has shown two similar questions asked in the past
> but no answer was posted in reply to them.
>
> Stephen
> --
>
> 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