[CMake] Setting properties to interface

Tiago Macarios tiagomacarios at gmail.com
Sat Apr 15 22:45:38 EDT 2017


Hi,

Given a template-only library exposed throw an interface is it possible to
set the necessary CXX_STANDARD necessary to use the library? The code below
would be what I am trying to do.

add_library(a_lib INTERFACE)

set_property(TARGET a_lib
    PROPERTY CXX_STANDARD 11
    PROPERTY CXX_STANDARD_REQUIRED ON
)

target_compile_definitions(a_lib INTERFACE
    SOME_DEF
)


Unfortunately, this does not work and fails with:

  INTERFACE_LIBRARY targets may only have whitelisted properties.
  The property "CXX_STANDARD_REQUIRED" is not allowed.

Any ideas?

Tiago
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20170415/9663b5b4/attachment.html>


More information about the CMake mailing list