cmake_minimum_required(VERSION 3.6)
project(Example)
set(CMAKE_C_STANDARD 11)
set(CMAKE_COMPILER_IS_GNUCC TRUE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
set(SOURCE_FILES main.c)
add_executable(Example ${SOURCE_FILES})
I am learning C11 and I am using the CLion IDE. In this IDE, the only possible option is to use CMake for projects, and I read several CMake manuals (in stack overflows too), and I did not find a ready-made solution for writing the correct CMakeLists for C11 projects.
set(CMAKE_C_STANDARD 11)
This line sets the standard to C11.
set(CMAKE_COMPILER_IS_GNUCC TRUE)
This line sets gcc as a compiler.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
This line sets the default compilation flags for the IDE.
Is my CMakeLists.txt correct?
source
share