Skip to content

Commit

Permalink
explicitly set C++ version to 14
Browse files Browse the repository at this point in the history
This was already the case with MSVC which defaults to C++14. In the
case of clang, this was causing build failures as C++14 features are
used in the codebase. In the case of gcc, the libc++ used there is
non-standards conformant and exposes C++14 features to C++11.

This fixes compilation under FreeBSD which uses clang and libcxx as the
codebase introduced C++14 stuff recently.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
  • Loading branch information
neheb committed Jan 25, 2021
1 parent d5f6ad7 commit bdf8225
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,9 @@ option(GIT_SUBMODULE "Check submodules during build" ON)
### COMPILER SETTINGS
#
#
IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CXX_EXTENSIONS NO)
ENDIF()
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

IF(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-switch -Wno-parentheses-equality -Wno-deprecated-declarations -Wno-tautological-compare -Wno-unused-value -Wno-comment -Wno-unsequenced -Wno-logical-op-parentheses -Wno-literal-conversion")
Expand All @@ -62,7 +60,7 @@ IF(CMAKE_SYSTEM_NAME STREQUAL "NetBSD")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
ENDIF()
IF(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-psabi -rdynamic")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-psabi -rdynamic")
#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-switch")
#ADD_DEFINITIONS( -Wall -O0 -ggdb )
#ADD_DEFINITIONS( -Wfatal-errors -Wformat=2 -Werror=format-security )
Expand Down

0 comments on commit bdf8225

Please sign in to comment.