Skip to content

Commit 01df1cb

Browse files
committed
de-vendor gtest and bump to 1.15.2
1 parent b9a73a3 commit 01df1cb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+33
-26175
lines changed

CMakeLists.txt

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,41 @@ PDAL_PYTHON_ADD_PLUGIN(python_filter filter python
203203

204204

205205
if (WITH_TESTS)
206-
set(GOOGLETEST_VERSION 1.12.1)
207-
208206
enable_testing()
207+
208+
message(STATUS "Fetching GTest from GitHub ...")
209+
210+
# Add Google Test
211+
#
212+
# See https://github.com/google/googletest/blob/main/googletest/README.md
213+
214+
if(POLICY CMP0135)
215+
cmake_policy(SET CMP0135 NEW) # for DOWNLOAD_EXTRACT_TIMESTAMP option
216+
endif()
217+
218+
set(GTEST_VERSION "1.15.2")
219+
220+
include(FetchContent)
221+
FetchContent_Declare(
222+
googletest
223+
URL https://github.com/google/googletest/archive/refs/tags/v${GTEST_VERSION}.zip
224+
EXCLUDE_FROM_ALL # ignored before CMake 3.28
225+
)
226+
227+
# For Windows: Prevent overriding the parent project's compiler/linker settings
209228
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
210-
add_subdirectory(src/pdal/test/gtest)
211-
enable_testing()
212-
include_directories(pdal/test/gtest/include .. ${CMAKE_CURRENT_BINARY_DIR})
229+
230+
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.28.0")
231+
FetchContent_MakeAvailable(googletest)
232+
else()
233+
# Pre CMake 3.28 workaround to prevent installing files
234+
FetchContent_GetProperties(googletest)
235+
if(NOT googletest_POPULATED)
236+
FetchContent_Populate(googletest)
237+
add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR} EXCLUDE_FROM_ALL)
238+
endif()
239+
endif()
240+
213241
PDAL_PYTHON_ADD_TEST(pdal_io_numpy_test
214242
FILES
215243
./src/pdal/test/NumpyReaderTest.cpp

src/pdal/test/gtest/CMakeLists.txt

Lines changed: 0 additions & 322 deletions
This file was deleted.

0 commit comments

Comments
 (0)