As per my other email just now, you should be able to achieve what you want
with the new CMake 3.8.0 release:

add_library(a_lib INTERFACE)
target_compile_features(a_lib INTERFACE cxx_std_11)

I did a quick test with the above just now and it seems to work as
expected. You may, however, still want to set the CXX_EXTENSIONS target
property (or set it project wide with CMAKE_CXX_EXTENSIONS) to control
whether or not compiler extensions are enabled too.



On Sun, Apr 16, 2017 at 12:45 PM, Tiago Macarios <tiagomacar...@gmail.com>
wrote:

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



-- 
Craig Scott
Melbourne, Australia
https://crascit.com
-- 

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

Reply via email to