Skip to content

Commit

Permalink
Merge pull request #1221 from slyshykO/cstd
Browse files Browse the repository at this point in the history
Set C standard through cmake variables
  • Loading branch information
Nightwalker-87 committed Feb 4, 2022
2 parents 924e1ec + cf6bdbf commit c2e74c2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS ON)


###
# General project settings
Expand Down
4 changes: 0 additions & 4 deletions cmake/modules/c_flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ function(add_cflag_if_supported flag)
endif ()
endfunction()

add_cflag_if_supported("-std=gnu11")
add_cflag_if_supported("-std=gnu18")
add_cflag_if_supported("-Wall")
add_cflag_if_supported("-Wextra")
add_cflag_if_supported("-Wshadow")
Expand Down Expand Up @@ -47,8 +45,6 @@ endif ()

if (${CMAKE_BUILD_TYPE} MATCHES "Debug")
add_cflag_if_supported("-ggdb")
add_cflag_if_supported("-O0")
else ()
add_cflag_if_supported("-O2")
add_cflag_if_supported("-Werror")
endif ()

0 comments on commit c2e74c2

Please sign in to comment.