Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion cmake/modules/GoogleTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,20 @@ if(WIN32)
-Dgtest_force_shared_crt=ON
BUILD_COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR> --config $<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}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am wondering if we need to propagate CMAKE_CXX_COMPILER to the CMAKE_ARGS. Alternatively in CMAKE_ARGS we can append -no-pedantic to disable the default mode.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping.

endif()

include(ExternalProject)
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
Expand All @@ -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)
Expand Down
Loading