]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Use older version of Google test to support older versions of GCC.
authorNathan Moinvaziri <nathan@nathanm.com>
Mon, 7 Mar 2022 16:25:42 +0000 (08:25 -0800)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Sun, 13 Mar 2022 06:41:12 +0000 (07:41 +0100)
Allow specifying alternative Google test repository and tag.

test/CMakeLists.txt

index 9def5f120a1761db5e559371ab8f32964a51ed4d..35655a3d0dde5d4a89d96cbf48c8b014bfa6c918 100644 (file)
@@ -25,10 +25,23 @@ set(gtest_force_shared_crt ON CACHE BOOL
 set(gtest_disable_pthreads ON CACHE BOOL
     "Disable uses of pthreads in gtest." FORCE)
 
+# Allow specifying alternative Google test repository
+if(NOT DEFINED GTEST_REPOSITORY)
+    set(GTEST_REPOSITORY https://github.com/google/googletest.git)
+endif()
+if(NOT DEFINED GTEST_TAG)
+    # Use older version of Google test to support older versions of GCC
+    if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS_EQUAL 5.3)
+        set(GTEST_TAG release-1.10.0)
+    else()
+        set(GTEST_TAG main)
+    endif()
+endif()
+
 # Fetch Google test source code from official repository
 FetchContent_Declare(googletest
-    GIT_REPOSITORY https://github.com/google/googletest.git
-    GIT_TAG main)
+    GIT_REPOSITORY ${GTEST_REPOSITORY}
+    GIT_TAG ${GTEST_TAG})
 
 FetchContent_GetProperties(googletest)
 if(NOT googletest_POPULATED)