Skip to content

Commit

Permalink
Set C and C++ standards the modern Cmake way, and set C++ to C++17.
Browse files Browse the repository at this point in the history
Boost has to go to 1.67 as well because boost::locale used auto_ptr
before that and it's been removed from the language in C++17.
  • Loading branch information
jralls committed Oct 8, 2019
1 parent 5e41c79 commit b5afd2e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
14 changes: 9 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ set (Boost_FIND_QUIETLY ON)
if (NOT DEFINED ${BOOST_ROOT})
set(BOOST_ROOT $ENV{BOOST_ROOT})
endif()
find_package (Boost 1.54.0 REQUIRED COMPONENTS date_time regex locale filesystem system)
find_package (Boost 1.67.0 REQUIRED COMPONENTS date_time regex locale filesystem system)

if (Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
Expand All @@ -534,18 +534,22 @@ endif()
add_definitions(-D_GNU_SOURCE)

# Also, set the C++ version to c++11
set(CMAKE_CXX_FLAGS "-std=gnu++11 ${CMAKE_CXX_FLAGS}") # FIXME: should be -std=c++11

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS ON)

if (UNIX)
set( CMAKE_C_FLAGS "-Werror -Wdeclaration-after-statement -Wno-pointer-sign -Wall -Wmissing-prototypes -Wmissing-declarations -Wno-unused ${CMAKE_C_FLAGS}")
set( CMAKE_C_FLAGS "-Wno-error=deprecated-declarations -std=gnu11 -Wno-error=parentheses ${CMAKE_C_FLAGS}")
set( CMAKE_C_FLAGS "-Wno-error=deprecated-declarations -Wno-error=parentheses ${CMAKE_C_FLAGS}")
set( CMAKE_CXX_FLAGS "-Werror -Wall -Wmissing-declarations -Wno-unused -Wno-error=parentheses ${CMAKE_CXX_FLAGS}")
set( CMAKE_CXX_FLAGS "-Wno-error=deprecated-declarations ${REGISTER_CXXFLAG} ${CMAKE_CXX_FLAGS}")
set( CMAKE_C_FLAGS_RELEASE "-O3 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 ${CMAKE_C_FLAGS}")
endif (UNIX)
if (MINGW)
set( CMAKE_C_FLAGS "-Werror -Wdeclaration-after-statement -Wno-pointer-sign -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wno-unused -Wno-error=deprecated-declarations -std=gnu11 ${CMAKE_C_FLAGS}")
set( CMAKE_C_FLAGS "-Werror -Wdeclaration-after-statement -Wno-pointer-sign -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wno-unused -Wno-error=deprecated-declarations ${CMAKE_C_FLAGS}")
set( CMAKE_CXX_FLAGS "-DWINVER=0x0500 -D_EMULATE_GLIBC=0 ${CMAKE_CXX_FLAGS}") # Workaround for bug in gtest on mingw, see https://github.com/google/googletest/issues/893 and https://github.com/google/googletest/issues/920
endif (MINGW)

Expand Down
8 changes: 5 additions & 3 deletions README.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ Libraries/Deps
--------------
required Version
-------- _______
gcc or clang 8.0 (gcc)/6.0 (clang) C/C++ compiler
cmake 3.10 Build system.
glib2 2.40.0
gtk+3 3.14.0
guile 2.2.0 or 2.0.0
Expand All @@ -70,12 +72,12 @@ Libraries/Deps
libxslt, including xsltproc
ICU International Components for
Unicode
boost 1.50.0 locale and regex libs must be
boost 1.67.0 locale and regex libs must be
built with ICU support.
swig 2.0.10 Only required to build from git.
swig 3.0.12 Makes Guile and Python Bindings.
webkit webkitgtk-3.0 (Windows, Mac)
webkit2gtk-3.0 (Everything Else)
googletest 1.7.0 Some distros call it gtest.
googletest 1.8.0 Some distros call it gtest.
Some distros also separate out
googlemock or gmock; both are
required.
Expand Down

0 comments on commit b5afd2e

Please sign in to comment.