[CMake] target_compile_features question

Jan Christoph Uhde linux at obiwahn.org
Sun Nov 5 09:07:05 EST 2017


Hi,

I have a project using CMake 3.9.
The project contains a header only library mylib.
The library hast set the following property:

    target_compile_features(mylib INTERFACE cxx_std_17)

Now I try to add otherlib to mylib (INTERFACE as well). otherlib has set
some c++11 compile_features.

When I try to compile tests for my lib I see gnu++11 as requested
standard. Without otherlib gnu++17 is selected.

Could this be a bug or I am using CMake in a wrong way. What is the best
way to set the required standard for a header-only library?

Thank You

Jan


https://travis-ci.org/ObiWahn/libobi/builds/297542567
https://github.com/ObiWahn/libobi/blob/cmake_problem/CMakeLists.txt#L31
- mylib
https://github.com/kvasir-io/mpl/blob/development/CMakeLists.txt#L11 -
otherlib


More information about the CMake mailing list