diff options
author | Andres Noetzli <andres.noetzli@gmail.com> | 2021-07-23 13:47:16 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-23 20:47:16 +0000 |
commit | df4c8cbe704fce51623bc9540def9b8806af4fd9 (patch) | |
tree | 8bfa5028d49ebd2c96fbcdf3d0833a3029f61257 | |
parent | 6931c8b3d078e9f5386837955dde2d786fcb1547 (diff) |
Fix CoCoA build for newer compilers (#6919)
Newer compilers, such as GCC 11, default to C++17. CoCoA does not
compile with C++17 and its check for the C++ version used by the
compiler does not take into account newer C++ versions. As a result,
building CoCoA using `--auto-download` fails with GCC 11. This commit
adds a patch that makes the test in CoCoA take into account compilers
that default to C++17 or newer.
-rw-r--r-- | cmake/FindCoCoA.cmake | 4 | ||||
-rw-r--r-- | cmake/deps-utils/CoCoA-patch-0.99712.patch | 13 |
2 files changed, 17 insertions, 0 deletions
diff --git a/cmake/FindCoCoA.cmake b/cmake/FindCoCoA.cmake index 1a4f82e9f..d84bf0f2c 100644 --- a/cmake/FindCoCoA.cmake +++ b/cmake/FindCoCoA.cmake @@ -56,6 +56,10 @@ if(NOT CoCoA_FOUND_SYSTEM) ${COMMON_EP_CONFIG} URL "http://cocoa.dima.unige.it/cocoalib/tgz/CoCoALib-${CoCoA_VERSION}.tgz" URL_HASH SHA1=873d0b60800cd3852939816ce0aa2e7f72dac4ce + # CoCoA requires C++14, but the check does not work with compilers that + # default to C++17 or newer. The patch fixes the check. + PATCH_COMMAND patch -p1 -d <SOURCE_DIR> + -i ${CMAKE_CURRENT_LIST_DIR}/deps-utils/CoCoA-patch-0.99712.patch BUILD_IN_SOURCE YES CONFIGURE_COMMAND ./configure --prefix=<INSTALL_DIR> BUILD_COMMAND ${make_cmd} library diff --git a/cmake/deps-utils/CoCoA-patch-0.99712.patch b/cmake/deps-utils/CoCoA-patch-0.99712.patch new file mode 100644 index 000000000..464d39f83 --- /dev/null +++ b/cmake/deps-utils/CoCoA-patch-0.99712.patch @@ -0,0 +1,13 @@ +diff --git a/configuration/cxx14.sh b/configuration/cxx14.sh +index cdbf338..0436983 100755 +--- a/configuration/cxx14.sh ++++ b/configuration/cxx14.sh +@@ -40,7 +40,7 @@ int main() + { + int ReturnCode = 0; // will mean c++14 compliant + std::cout << "C++ version: " << __cplusplus << std::endl; +-#if __cplusplus < 201400L ++#if __cplusplus < 201400L || __cplusplus >= 201703L + ReturnCode = 1; // NOT C++14 compilant + #endif + return ReturnCode; |