How to enable C++17 in CMake

前端 未结 6 1625
旧时难觅i
旧时难觅i 2020-12-05 22:45

I\'m using VS 15.3, which supports integrated CMake 3.8. How can I target C++17 without writing flags for each specific compilers? My current global settings don\'t work:

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-05 23:00

    Modern CMake propose an interface for this purpose target_compile_features. Documentation is here: Requiring Language Standards

    Use it like this:

    target_compile_features(${TARGET_NAME} PRIVATE cxx_std_17)

提交回复
热议问题