I have to support cmake 2.6 at least (and latest versions like 3.12 too):
cmake_minimum_required(VERSION 2.6)
And want to specify the old c++ standard (c++98) and forbid gnu extensions (use -std=c++98 instead of -std=gnu++98). In newer versions (since 3.0) we have CXX_EXTENSIONS and CXX_STANDARD , but I can't use them because cmake 2.6 doesn't support them.
I tried to specify add_definitions(-std=c++98)
, but it causes compile string like this:
/usr/bin/c++ ..... -std=c++98 ..... -std=gnu++98 .....
您始终可以将CMAKE_CXX_FLAGS
设置(或修改)为-std=c++98
以否决CMake自己设置的内容。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.