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

Klaim - Joël Lamotte mjklaim at gmail.com
Wed Dec 30 14:52:42 EST 2015


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20151230/9017a3d1/attachment.html>


More information about the CMake mailing list