From 54113ef58ead7fbc09416c1d29f51988342a4f0a Mon Sep 17 00:00:00 2001 From: mcbarton <150042563+mcbarton@users.noreply.github.com> Date: Mon, 28 Oct 2024 20:36:11 +0000 Subject: [PATCH 1/3] Update gtest used to v1.15.2 --- cmake/modules/GoogleTest.cmake | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cmake/modules/GoogleTest.cmake b/cmake/modules/GoogleTest.cmake index 035289f47..3ddebb544 100644 --- a/cmake/modules/GoogleTest.cmake +++ b/cmake/modules/GoogleTest.cmake @@ -16,7 +16,12 @@ if(WIN32) -Dgtest_force_shared_crt=ON BUILD_COMMAND ${CMAKE_COMMAND} --build --config $) elseif(APPLE) + #FIXME: Temporarily remove -pedantic from CMAKE_CXX_FLAGS to avoid issues with building + # latest version of gtest on MacOS (use of -Wc++17-attribute-extensions causes + # issues due to [[maybe_unused]] in gtest) set(EXTRA_GTEST_OPTS -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT}) + set(CMAKE_CXX_FLAGS_TEMP_COPY ${CMAKE_CXX_FLAGS}) + string(REPLACE "-pedantic" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") endif() include(ExternalProject) @@ -24,7 +29,7 @@ ExternalProject_Add( googletest GIT_REPOSITORY https://github.com/google/googletest.git GIT_SHALLOW 1 - GIT_TAG release-1.12.1 + GIT_TAG v1.15.2 UPDATE_COMMAND "" # # Force separate output paths for debug and release builds to allow easy # # identification of correct lib in subsequent TARGET_LINK_LIBRARIES commands @@ -50,6 +55,11 @@ ExternalProject_Add( TIMEOUT 600 ) +#FIXME: Related to fixme above which temporarily remodifies CMAKE_CXX_FLAGS +if(APPLE) + set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS_TEMP_COPY}) +endif() + # Specify include dirs for gtest and gmock ExternalProject_Get_Property(googletest source_dir) set(GTEST_INCLUDE_DIR ${source_dir}/googletest/include) From ba6987125f64424b640ea609c9442c95bff70c77 Mon Sep 17 00:00:00 2001 From: mcbarton <150042563+mcbarton@users.noreply.github.com> Date: Wed, 27 Nov 2024 18:22:42 +0000 Subject: [PATCH 2/3] Remove pedantic from CXX_FLAGS Apple --- CMakeLists.txt | 6 +++++- cmake/modules/GoogleTest.cmake | 9 --------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 311ef42c7..d8a818872 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -299,7 +299,11 @@ endif() # Add appropriate flags for GCC if (LLVM_COMPILER_IS_GCC_COMPATIBLE) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-common -Woverloaded-virtual -Wcast-qual -fno-strict-aliasing -pedantic -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings") + if (APPLE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-common -Woverloaded-virtual -Wcast-qual -fno-strict-aliasing -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings") + else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-common -Woverloaded-virtual -Wcast-qual -fno-strict-aliasing -pedantic -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings") + endif () endif () # Fixes "C++ exception handler used, but unwind semantics are not enabled" warning Windows diff --git a/cmake/modules/GoogleTest.cmake b/cmake/modules/GoogleTest.cmake index 3ddebb544..6b46bed5e 100644 --- a/cmake/modules/GoogleTest.cmake +++ b/cmake/modules/GoogleTest.cmake @@ -16,12 +16,7 @@ if(WIN32) -Dgtest_force_shared_crt=ON BUILD_COMMAND ${CMAKE_COMMAND} --build --config $) elseif(APPLE) - #FIXME: Temporarily remove -pedantic from CMAKE_CXX_FLAGS to avoid issues with building - # latest version of gtest on MacOS (use of -Wc++17-attribute-extensions causes - # issues due to [[maybe_unused]] in gtest) set(EXTRA_GTEST_OPTS -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT}) - set(CMAKE_CXX_FLAGS_TEMP_COPY ${CMAKE_CXX_FLAGS}) - string(REPLACE "-pedantic" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") endif() include(ExternalProject) @@ -55,10 +50,6 @@ ExternalProject_Add( TIMEOUT 600 ) -#FIXME: Related to fixme above which temporarily remodifies CMAKE_CXX_FLAGS -if(APPLE) - set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS_TEMP_COPY}) -endif() # Specify include dirs for gtest and gmock ExternalProject_Get_Property(googletest source_dir) From b631767a23f21f0641b5edfd91f27ad849d057c9 Mon Sep 17 00:00:00 2001 From: mcbarton <150042563+mcbarton@users.noreply.github.com> Date: Wed, 27 Nov 2024 18:23:11 +0000 Subject: [PATCH 3/3] Remove added line --- cmake/modules/GoogleTest.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/cmake/modules/GoogleTest.cmake b/cmake/modules/GoogleTest.cmake index 6b46bed5e..a753c1c94 100644 --- a/cmake/modules/GoogleTest.cmake +++ b/cmake/modules/GoogleTest.cmake @@ -50,7 +50,6 @@ ExternalProject_Add( TIMEOUT 600 ) - # Specify include dirs for gtest and gmock ExternalProject_Get_Property(googletest source_dir) set(GTEST_INCLUDE_DIR ${source_dir}/googletest/include)