Created
October 5, 2019 17:54
-
-
Save jralls/8a2afd5993b96fa5834ed014d0861b55 to your computer and use it in GitHub Desktop.
Change GnuCash CMakeLists.txt for C++17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/CMakeLists.txt | |
+++ b/CMakeLists.txt | |
@@ -532,18 +532,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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment