1

For some reason I cannot configure CLion to only use C++98 for my project

  1. I keep getting clang-tidy for c++11 instead of c++98 (How do I set it to C++98)
  2. I do not get any red lines or compiler errors when I use syntax for C++ versions greater than C++98 (How do I enable strict enforcement of C++98)
  3. When I set the IDE to C++98 I do not want the IDE to let me use any standard greater than C++98 (How do I do this?)

Does anyone know how to enforce this standard in CLion? My guess is to configure the cmake file to C++98. Not sure if I'm doing it right though...

My CMakeLists.txt is shown below

cmake_minimum_required(VERSION 3.10)
project(myProject)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c98")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98")
set(CMAKE_CXX_STANDARD 98)

add_executable(myProject main.cpp Myclass.cpp Myclass.h)
add_definitions(-std=c++98)

p.s I do not have the option to work in any other version than C++98 and lower due to hardware constraints.

Tim
  • 1,606
  • 2
  • 21
  • 42
  • 1
    I'd file a bug about a few of these things, in particular getting clang tidy reports for the wrong standard. – Mikhail Apr 24 '18 at 23:10

1 Answers1

2

I have had similar problem and setting standard for a target worked, it would be something like

set_property(TARGET myProject PROPERTY CXX_STANDARD 98)

for you