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

Klaim - Joël Lamotte mjklaim at gmail.com
Sun Jan 3 10:24:40 EST 2016


On 3 January 2016 at 10:18, Jakob van Bethlehem <jsvanbethlehem at gmail.com>
wrote:

> Hej,
>
> Just re-read your question to make sure I understood, because I thought in
> the project I currently work in we had those targets, but not the problems.
> So I checked and realised we actually gotten rid of those INTERFACE
> libraries, because we encountered all kinds of trouble, amongst which one
> is the problem you refer to. Another problem for instance, is that
> INTERFACE link dependencies don’t get transferred like with normal
> libraries. Extremely annoying, so we decided the ‘academical’ use of an
> INTERFACE library wasn’t (nearly) worth the effort.
>
> Not a resolution to your problem though ……
>
>
I reached the same conclusion, but then I wonder what solution did you end
up using for header-only libraries?
Before trying interfaces I had these static libraries with one cpp which
was generated by a leak detection tool, therefore without
leak detection activated the libraries don't generate anything and can't be
linked to.
Adding a custom cpp for static header-only libraries is a bit sad but looks
like a simple way to do it.


> Sincerely, Jakob
>
>
> On 02 Jan 2016, at 13:12, Klaim - Joël Lamotte <mjklaim at gmail.com> wrote:
>
>
>
> 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
>
>
>
> --
>
> 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/20160103/0eb4ebf3/attachment.html>


More information about the CMake mailing list