CMake 3.15 cxx_std_98 doesn't set C++98 standard flag
Looks like CMake beginning from v3.15.0 no longer sets the appropriate standard flag when C++98 is specified.
Here's the CMakeLists.txt
I used:
cmake_minimum_required(VERSION 3.15)
project(Test)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_executable(Test main.cpp)
target_compile_features(Test PRIVATE cxx_std_98)
main.cpp
:
int main()
{
}
The resulting compile_commands.json
:
[
{
"directory": "/home/shyun3/tmp/build",
"command": "/usr/bin/c++ -o CMakeFiles/Test.dir/main.cpp.o -c /home/shyun3/tmp/main.cpp",
"file": "/home/shyun3/tmp/main.cpp"
}
]
Using CMake v3.14.6 yields:
[
{
"directory": "/home/shyun3/tmp/build-3.14",
"command": "/usr/bin/c++ -std=gnu++98 -o CMakeFiles/Test.dir/main.cpp.o -c /home/shyun3/tmp/main.cpp",
"file": "/home/shyun3/tmp/main.cpp"
}
]
This was on WSL using GCC 4.8.4.