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

Jakob van Bethlehem jsvanbethlehem at gmail.com
Sun Jan 3 04:18:48 EST 2016


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 ……

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 <mailto: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 <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 <mailto: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 <http://www.kitware.com/>
>> 
>> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ <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 <http://cmake.org/cmake/help/support.html>
>> CMake Consulting: http://cmake.org/cmake/help/consulting.html <http://cmake.org/cmake/help/consulting.html>
>> CMake Training Courses: http://cmake.org/cmake/help/training.html <http://cmake.org/cmake/help/training.html>
>> 
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html <http://www.kitware.com/opensource/opensource.html>
>> 
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/cmake <http://public.kitware.com/mailman/listinfo/cmake>
> 
> --
> 
> Powered by www.kitware.com <http://www.kitware.com/>
> 
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ <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 <http://cmake.org/cmake/help/support.html>
> CMake Consulting: http://cmake.org/cmake/help/consulting.html <http://cmake.org/cmake/help/consulting.html>
> CMake Training Courses: http://cmake.org/cmake/help/training.html <http://cmake.org/cmake/help/training.html>
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html <http://www.kitware.com/opensource/opensource.html>
> 
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake <http://public.kitware.com/mailman/listinfo/cmake>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160103/843c93cd/attachment-0001.html>


More information about the CMake mailing list