If you require CMake 3.8+, you can just use compilefeatures to set a minimium standard level, like cxxstd. Or you can manually list compilefeatures for individual C++11 and C++14 features, and, and all targets using yours will get at least that level set on them. However it seems a bit hacky and I still dont have a clue what actually appends this variable to the build command. If you require CMake 3.1+, you can set CXXSTANDARD, but only on a final target. To expand a bit on the ADD_COMPILE_OPTIONS() with generator expression answer by ar31, you may run into a problem when you want to add multiple flags separated by spaces, as cmake has a nasty bug in generator expressions. My current workaround is setting it to the desired standard in my CMakeLists.txt: set (CMAKECXX11EXTENSIONCOMPILEOPTION '-stdc++17') This works.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |