Unable to set c++ standard (c++17) in cmake 3.9.2

Viewed 1303

When using cmake (3.9.2) the command:

set(CMAKE_CXX_STANDARD 17)

does not correctly add the flag -std=c++17.

The macro __cplusplus expands to 199711. I also get errors with regards to c++11 features like initalization_lists.

I am using clang++ 5.0.0. I would also like to be able to use clang-tidy from cmake via:

set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-checks=*")

This only seems to be an issue after upgrading cmake from version 3.7.1.

I can't seem to locate any documentation on a relevant change between the versions. Am I missing something? Do clang 5.0 and cmake 3.9.2 have some compatibility issues?

Thanks.

0 Answers
Related