jeudi 5 octobre 2017

CMake make library require cxx standard

I try to make my library target to depend on c++14. How can i achieve, that the targets, that link against my library target also depend on c++14?

I tried to use:

add_library(lib SHARED ${FILES})
target_compile_options(lib INTERFACE CXX_STANDARD 14)

This works to build the library, but when i try to compile other targets using lib C++14 is not activated.

I am aware, that there are other methods, but i can't get them to work. Namely there is:

set_target_properties()

The reason for this is, that the library headers make use of generalised lambda capture and template aliases like std::remove_reference_t and similar, that are in the standard library since c++14.

Aucun commentaire:

Enregistrer un commentaire