[CMake] Cannot set FOLDER property to an interface (header-only) target

Klaim - Joël Lamotte mjklaim at gmail.com
Sat Jan 2 07:12:18 EST 2016


On 1 January 2016 at 11:00, Jakob van Bethlehem <jsvanbethlehem at gmail.com>
wrote:

> Hej Joël,
>
> The command you’re looking for is ‘source_group’, see
> https://cmake.org/cmake/help/v3.0/command/source_group.html
>
>
I use this already but it works only with source files, not with targets.
With targets you need to set the FOLDER property.


> Sincerely,
> Jakob
>
>
> On 30 Dec 2015, at 20:52, Klaim - Joël Lamotte <mjklaim at gmail.com> wrote:
>
> The following CMake script:
>
>     cmake_minimum_required(VERSION 3.4)
>
>     add_library( mylib INTERFACE )
>     set_property( TARGET mylib PROPERTY FOLDER /some/dir )
>
>
> Will trigger this error on configuration:
>
>     CMake Error at CMakeLists.txt:4 (set_property):
>       INTERFACE_LIBRARY targets may only have whitelisted properties.  The
>       property "FOLDER" is not allowed.
>
>
> This prevent any interface library to be organized in Visual Studio
> virtual folders.
> Unfortunately it also mean that header-only targets can't be organized.
>
> I have no idea how this should be solved. Should the property just be
> white-listed?
> Or should a better have a another specific library mode for header-only
> targets?
>
> Is there any workaround?
>
> Joël Lamotte
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
>
>
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160102/b9eac585/attachment.html>


More information about the CMake mailing list