From 56346b6beb045b080d9615726fe3836862697435 Mon Sep 17 00:00:00 2001 From: David Sisson Date: Tue, 20 Feb 2024 23:49:37 -0800 Subject: [PATCH 01/18] Everything working except protobuf-matchers. --- CMakeLists.txt | 26 ++++++++++++++++++++++---- third_party/CMakeLists.txt | 5 ++++- third_party/protobuf-matchers | 2 +- third_party/protobuf.cmake | 13 +++++++++++++ 4 files changed, 40 insertions(+), 6 deletions(-) create mode 100644 third_party/protobuf.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index b4644b23..655e6975 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.20) +cmake_minimum_required(VERSION 3.24) # set the project name project(substrait-cpp) @@ -39,11 +39,29 @@ include_directories(src) # available otherwise we fallback to the older protobuf method. find_package(Protobuf QUIET CONFIG) if(${Protobuf_FOUND}) + message(STATUS "Modern protobuf library located.") set(ABSL_INCLUDED_WITH_PROTOBUF ON) + set(GOOGLETEST_INCLUDED_WITH_ABSL OFF) else() - find_package(Protobuf REQUIRED) - include_directories(${Protobuf_INCLUDE_DIRS}) - set(ABSL_INCLUDED_WITH_PROTOBUF OFF) + find_package(Protobuf QUIET) + if(${Protobuf_FOUND}) + message(STATUS "Legacy protobuf library located.") + include_directories(${Protobuf_INCLUDE_DIRS}) + set(ABSL_INCLUDED_WITH_PROTOBUF OFF) + set(GOOGLETEST_INCLUDED_WITH_ABSL OFF) + else() + message(STATUS "Fetching external protobuf library.") + include(third_party/protobuf.cmake) + find_package(Protobuf CONFIG REQUIRED) + include_directories(${Protobuf_INCLUDE_DIRS}) + set(ABSL_INCLUDED_WITH_PROTOBUF ON) + set(GOOGLETEST_INCLUDED_WITH_ABSL ON) + find_package(GTest REQUIRED) + find_library(GMOCK_LIB GTest::gmock) + if(NOT GMOCK_LIB) + message(FATAL_ERROR "GMock was not built as part of GoogleTest.") + endif() + endif() endif() add_subdirectory(third_party) diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 2124c76d..64587202 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -8,7 +8,10 @@ endif() include(datetime.cmake) add_subdirectory(fmt) -add_subdirectory(googletest) + +if(NOT ${GOOGLETEST_INCLUDED_WITH_ABSL}) + add_subdirectory(googletest) +endif() add_subdirectory(protobuf-matchers) diff --git a/third_party/protobuf-matchers b/third_party/protobuf-matchers index 5917378d..a76296f5 160000 --- a/third_party/protobuf-matchers +++ b/third_party/protobuf-matchers @@ -1 +1 @@ -Subproject commit 5917378dcacf16c363b80c24a0d3c750f583b2b7 +Subproject commit a76296f5d5369d57f44126acf59c290a397490c6 diff --git a/third_party/protobuf.cmake b/third_party/protobuf.cmake new file mode 100644 index 00000000..00b1a718 --- /dev/null +++ b/third_party/protobuf.cmake @@ -0,0 +1,13 @@ +# SPDX-License-Identifier: Apache-2.0 + +include_guard(GLOBAL) + +set(ABSL_PROPAGATE_CXX_STD ON) + +include(FetchContent) +FetchContent_Declare(Protobuf + GIT_REPOSITORY https://github.com/protocolbuffers/protobuf.git + GIT_TAG v4.25.3 + OVERRIDE_FIND_PACKAGE + ) +FetchContent_MakeAvailable(Protobuf) From 7853b51ea88ae7a725f50a351757e86bb6935af5 Mon Sep 17 00:00:00 2001 From: David Sisson Date: Wed, 21 Feb 2024 02:50:32 -0800 Subject: [PATCH 02/18] Now working build with protobuf being provided externally if necessary. --- CMakeLists.txt | 21 ++++++++++++++------- export/planloader/CMakeLists.txt | 6 +++--- src/substrait/proto/CMakeLists.txt | 3 ++- third_party/protobuf.cmake | 13 ++++++++++--- 4 files changed, 29 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 655e6975..d88734e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,15 +52,22 @@ else() else() message(STATUS "Fetching external protobuf library.") include(third_party/protobuf.cmake) - find_package(Protobuf CONFIG REQUIRED) - include_directories(${Protobuf_INCLUDE_DIRS}) + #find_package(Protobuf CONFIG REQUIRED) + #include_directories(${Protobuf_INCLUDE_DIRS}) set(ABSL_INCLUDED_WITH_PROTOBUF ON) set(GOOGLETEST_INCLUDED_WITH_ABSL ON) - find_package(GTest REQUIRED) - find_library(GMOCK_LIB GTest::gmock) - if(NOT GMOCK_LIB) - message(FATAL_ERROR "GMock was not built as part of GoogleTest.") - endif() + #find_package(GTest) + #if(NOT {$GTest_FOUND}) + # message(FATAL_ERROR "GTest package not found.") + #endif() + #find_library(GTEST_LIB GTest) + #if(NOT GTEST_LIB) + # message(FATAL_ERROR "GTest was unexpectedly not included in Protobuf.") + #endif() + #find_library(GMOCK_LIB GTest::gmock) + #if(NOT GMOCK_LIB) + # message(FATAL_ERROR "GMock was not built as part of GoogleTest.") + #endif() endif() endif() diff --git a/export/planloader/CMakeLists.txt b/export/planloader/CMakeLists.txt index 13eceabe..70a9b2bc 100644 --- a/export/planloader/CMakeLists.txt +++ b/export/planloader/CMakeLists.txt @@ -1,9 +1,9 @@ # SPDX-License-Identifier: Apache-2.0 -if(NOT BUILD_SUBDIR_NAME EQUAL "release") +if(CMAKE_BUILD_TYPE MATCHES Debug) message( - SEND_ERROR, - "The planloader library does not work in Debug mode due to its dependencies." + WARNING + "The planloader library does not work well in Debug mode due to bundled heap checking." ) endif() diff --git a/src/substrait/proto/CMakeLists.txt b/src/substrait/proto/CMakeLists.txt index 26198013..6b51d9cf 100644 --- a/src/substrait/proto/CMakeLists.txt +++ b/src/substrait/proto/CMakeLists.txt @@ -65,7 +65,8 @@ foreach(PROTO_FILE IN LISTS PROTOBUF_FILELIST) set(PROTO_SRC ${PROTO_OUTPUT_PARENT_DIR}/proto/${RELATIVE_PROTO_PATH}.pb.cc) add_custom_command( OUTPUT ${PROTO_SRC} ${PROTO_HDR} - COMMAND protobuf::protoc "--proto_path=${GENERATED_PROTO_TOPLEVEL_DIR}" + COMMAND protobuf::protoc + "--proto_path=${GENERATED_PROTO_TOPLEVEL_DIR}:${protobuf_SOURCE_DIR}/src" "--cpp_out=${PROTO_OUTPUT_MIDLEVEL_DIR}" ${GENERATED_PROTO_FILE} DEPENDS ${GENERATED_PROTOBUF_LIST} protobuf::protoc COMMENT "Generated C++ protobuf module for ${PROTO_FILE}" diff --git a/third_party/protobuf.cmake b/third_party/protobuf.cmake index 00b1a718..30c63a2f 100644 --- a/third_party/protobuf.cmake +++ b/third_party/protobuf.cmake @@ -5,9 +5,16 @@ include_guard(GLOBAL) set(ABSL_PROPAGATE_CXX_STD ON) include(FetchContent) +FetchContent_Declare(GTest + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG v1.14.0 + OVERRIDE_FIND_PACKAGE +) FetchContent_Declare(Protobuf GIT_REPOSITORY https://github.com/protocolbuffers/protobuf.git - GIT_TAG v4.25.3 + GIT_TAG v23.4 + #SOURCE_SUBDIR cmake OVERRIDE_FIND_PACKAGE - ) -FetchContent_MakeAvailable(Protobuf) +) +set(protobuf_BUILD_TESTS OFF CACHE INTERNAL "") +FetchContent_MakeAvailable(Protobuf GTest) From 60562aef5df0088ff652d0805f9763a67a2bb426 Mon Sep 17 00:00:00 2001 From: David Sisson Date: Wed, 21 Feb 2024 02:53:02 -0800 Subject: [PATCH 03/18] Cleaned up. --- CMakeLists.txt | 20 +++----------------- third_party/CMakeLists.txt | 2 +- third_party/protobuf.cmake | 1 - 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d88734e4..2cea0223 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,33 +41,19 @@ find_package(Protobuf QUIET CONFIG) if(${Protobuf_FOUND}) message(STATUS "Modern protobuf library located.") set(ABSL_INCLUDED_WITH_PROTOBUF ON) - set(GOOGLETEST_INCLUDED_WITH_ABSL OFF) + set(GOOGLTEST_INCLUDED_WITH_PROTOBUF OFF) else() find_package(Protobuf QUIET) if(${Protobuf_FOUND}) message(STATUS "Legacy protobuf library located.") include_directories(${Protobuf_INCLUDE_DIRS}) set(ABSL_INCLUDED_WITH_PROTOBUF OFF) - set(GOOGLETEST_INCLUDED_WITH_ABSL OFF) + set(GOOGLTEST_INCLUDED_WITH_PROTOBUF OFF) else() message(STATUS "Fetching external protobuf library.") include(third_party/protobuf.cmake) - #find_package(Protobuf CONFIG REQUIRED) - #include_directories(${Protobuf_INCLUDE_DIRS}) set(ABSL_INCLUDED_WITH_PROTOBUF ON) - set(GOOGLETEST_INCLUDED_WITH_ABSL ON) - #find_package(GTest) - #if(NOT {$GTest_FOUND}) - # message(FATAL_ERROR "GTest package not found.") - #endif() - #find_library(GTEST_LIB GTest) - #if(NOT GTEST_LIB) - # message(FATAL_ERROR "GTest was unexpectedly not included in Protobuf.") - #endif() - #find_library(GMOCK_LIB GTest::gmock) - #if(NOT GMOCK_LIB) - # message(FATAL_ERROR "GMock was not built as part of GoogleTest.") - #endif() + set(GOOGLTEST_INCLUDED_WITH_PROTOBUF ON) endif() endif() diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 64587202..379fb12b 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -9,7 +9,7 @@ include(datetime.cmake) add_subdirectory(fmt) -if(NOT ${GOOGLETEST_INCLUDED_WITH_ABSL}) +if(NOT ${GOOGLTEST_INCLUDED_WITH_PROTOBUF}) add_subdirectory(googletest) endif() diff --git a/third_party/protobuf.cmake b/third_party/protobuf.cmake index 30c63a2f..e7942cf3 100644 --- a/third_party/protobuf.cmake +++ b/third_party/protobuf.cmake @@ -13,7 +13,6 @@ FetchContent_Declare(GTest FetchContent_Declare(Protobuf GIT_REPOSITORY https://github.com/protocolbuffers/protobuf.git GIT_TAG v23.4 - #SOURCE_SUBDIR cmake OVERRIDE_FIND_PACKAGE ) set(protobuf_BUILD_TESTS OFF CACHE INTERNAL "") From 3482f237b31cf44d9b52b97af89c43da58d8e16b Mon Sep 17 00:00:00 2001 From: David Sisson Date: Wed, 21 Feb 2024 02:55:32 -0800 Subject: [PATCH 04/18] Ran clang format. --- export/planloader/CMakeLists.txt | 2 +- src/substrait/proto/CMakeLists.txt | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/export/planloader/CMakeLists.txt b/export/planloader/CMakeLists.txt index 70a9b2bc..2294572c 100644 --- a/export/planloader/CMakeLists.txt +++ b/export/planloader/CMakeLists.txt @@ -3,7 +3,7 @@ if(CMAKE_BUILD_TYPE MATCHES Debug) message( WARNING - "The planloader library does not work well in Debug mode due to bundled heap checking." + "The planloader library does not work well in Debug mode due to bundled heap checking." ) endif() diff --git a/src/substrait/proto/CMakeLists.txt b/src/substrait/proto/CMakeLists.txt index 6b51d9cf..d0f8bd92 100644 --- a/src/substrait/proto/CMakeLists.txt +++ b/src/substrait/proto/CMakeLists.txt @@ -65,9 +65,10 @@ foreach(PROTO_FILE IN LISTS PROTOBUF_FILELIST) set(PROTO_SRC ${PROTO_OUTPUT_PARENT_DIR}/proto/${RELATIVE_PROTO_PATH}.pb.cc) add_custom_command( OUTPUT ${PROTO_SRC} ${PROTO_HDR} - COMMAND protobuf::protoc - "--proto_path=${GENERATED_PROTO_TOPLEVEL_DIR}:${protobuf_SOURCE_DIR}/src" - "--cpp_out=${PROTO_OUTPUT_MIDLEVEL_DIR}" ${GENERATED_PROTO_FILE} + COMMAND + protobuf::protoc + "--proto_path=${GENERATED_PROTO_TOPLEVEL_DIR}:${protobuf_SOURCE_DIR}/src" + "--cpp_out=${PROTO_OUTPUT_MIDLEVEL_DIR}" ${GENERATED_PROTO_FILE} DEPENDS ${GENERATED_PROTOBUF_LIST} protobuf::protoc COMMENT "Generated C++ protobuf module for ${PROTO_FILE}" VERBATIM) From 2f4a246c4189f6d70abb3595048f609364f0563b Mon Sep 17 00:00:00 2001 From: David Sisson Date: Wed, 21 Feb 2024 03:02:45 -0800 Subject: [PATCH 05/18] Update typo and try assuming GoogleTest comes with legacy Protobuf. --- CMakeLists.txt | 6 +++--- third_party/CMakeLists.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2cea0223..34b7faa5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,19 +41,19 @@ find_package(Protobuf QUIET CONFIG) if(${Protobuf_FOUND}) message(STATUS "Modern protobuf library located.") set(ABSL_INCLUDED_WITH_PROTOBUF ON) - set(GOOGLTEST_INCLUDED_WITH_PROTOBUF OFF) + set(GOOGLETEST_INCLUDED_WITH_PROTOBUF OFF) else() find_package(Protobuf QUIET) if(${Protobuf_FOUND}) message(STATUS "Legacy protobuf library located.") include_directories(${Protobuf_INCLUDE_DIRS}) set(ABSL_INCLUDED_WITH_PROTOBUF OFF) - set(GOOGLTEST_INCLUDED_WITH_PROTOBUF OFF) + set(GOOGLETEST_INCLUDED_WITH_PROTOBUF ON) else() message(STATUS "Fetching external protobuf library.") include(third_party/protobuf.cmake) set(ABSL_INCLUDED_WITH_PROTOBUF ON) - set(GOOGLTEST_INCLUDED_WITH_PROTOBUF ON) + set(GOOGLETEST_INCLUDED_WITH_PROTOBUF ON) endif() endif() diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 379fb12b..63488a1c 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -9,7 +9,7 @@ include(datetime.cmake) add_subdirectory(fmt) -if(NOT ${GOOGLTEST_INCLUDED_WITH_PROTOBUF}) +if(NOT ${GOOGLETEST_INCLUDED_WITH_PROTOBUF}) add_subdirectory(googletest) endif() From d1de570455510fdb856a575cd20bdc3ed3da2849 Mon Sep 17 00:00:00 2001 From: David Sisson Date: Wed, 21 Feb 2024 03:05:21 -0800 Subject: [PATCH 06/18] Back to the right way. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 34b7faa5..add6770f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,7 +48,7 @@ else() message(STATUS "Legacy protobuf library located.") include_directories(${Protobuf_INCLUDE_DIRS}) set(ABSL_INCLUDED_WITH_PROTOBUF OFF) - set(GOOGLETEST_INCLUDED_WITH_PROTOBUF ON) + set(GOOGLETEST_INCLUDED_WITH_PROTOBUF OFF) else() message(STATUS "Fetching external protobuf library.") include(third_party/protobuf.cmake) From 60904d27ebaa4f693dfae8a4e13c6ecf67f37f17 Mon Sep 17 00:00:00 2001 From: David Sisson Date: Wed, 21 Feb 2024 03:08:06 -0800 Subject: [PATCH 07/18] Added status information. --- third_party/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 63488a1c..b421f1d8 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -10,6 +10,7 @@ include(datetime.cmake) add_subdirectory(fmt) if(NOT ${GOOGLETEST_INCLUDED_WITH_PROTOBUF}) + message(STATUS "Using bundled GoogleTest library.") add_subdirectory(googletest) endif() From f5a8780656b59a1ad3a650fcab8107c0f86ac0ae Mon Sep 17 00:00:00 2001 From: David Sisson Date: Wed, 21 Feb 2024 07:57:42 -0800 Subject: [PATCH 08/18] Try using find_package to find GTest instead of guessing. --- CMakeLists.txt | 3 --- third_party/CMakeLists.txt | 3 ++- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index add6770f..2c977ce3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,19 +41,16 @@ find_package(Protobuf QUIET CONFIG) if(${Protobuf_FOUND}) message(STATUS "Modern protobuf library located.") set(ABSL_INCLUDED_WITH_PROTOBUF ON) - set(GOOGLETEST_INCLUDED_WITH_PROTOBUF OFF) else() find_package(Protobuf QUIET) if(${Protobuf_FOUND}) message(STATUS "Legacy protobuf library located.") include_directories(${Protobuf_INCLUDE_DIRS}) set(ABSL_INCLUDED_WITH_PROTOBUF OFF) - set(GOOGLETEST_INCLUDED_WITH_PROTOBUF OFF) else() message(STATUS "Fetching external protobuf library.") include(third_party/protobuf.cmake) set(ABSL_INCLUDED_WITH_PROTOBUF ON) - set(GOOGLETEST_INCLUDED_WITH_PROTOBUF ON) endif() endif() diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index b421f1d8..06a0d740 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -9,7 +9,8 @@ include(datetime.cmake) add_subdirectory(fmt) -if(NOT ${GOOGLETEST_INCLUDED_WITH_PROTOBUF}) +find_package(GTest QUIET) +if(NOT ${GTEST_FOUND}) message(STATUS "Using bundled GoogleTest library.") add_subdirectory(googletest) endif() From cca9ff84f8b5e91e3c50eb94ce810a2c9a30a8b0 Mon Sep 17 00:00:00 2001 From: David Sisson Date: Wed, 21 Feb 2024 08:20:26 -0800 Subject: [PATCH 09/18] Experiment --- third_party/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 06a0d740..37f1488d 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -12,7 +12,8 @@ add_subdirectory(fmt) find_package(GTest QUIET) if(NOT ${GTEST_FOUND}) message(STATUS "Using bundled GoogleTest library.") - add_subdirectory(googletest) + #add_subdirectory(googletest) + find_package(GTest REQUIRED PATHS gogoogletest) endif() add_subdirectory(protobuf-matchers) From 311a4f3f7120461217bb7cc1127d173fce2f249e Mon Sep 17 00:00:00 2001 From: David Sisson Date: Wed, 21 Feb 2024 08:23:18 -0800 Subject: [PATCH 10/18] changed --- third_party/CMakeLists.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 37f1488d..d3e4a9fe 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -9,11 +9,10 @@ include(datetime.cmake) add_subdirectory(fmt) -find_package(GTest QUIET) +find_package(GTest QUIET CONFIG) if(NOT ${GTEST_FOUND}) message(STATUS "Using bundled GoogleTest library.") - #add_subdirectory(googletest) - find_package(GTest REQUIRED PATHS gogoogletest) + add_subdirectory(googletest) endif() add_subdirectory(protobuf-matchers) From 38b8600ee19929d44977c6cc67a9bbda50509587 Mon Sep 17 00:00:00 2001 From: David Sisson Date: Wed, 21 Feb 2024 08:39:43 -0800 Subject: [PATCH 11/18] try a workaround --- third_party/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index d3e4a9fe..08d99d18 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -13,6 +13,11 @@ find_package(GTest QUIET CONFIG) if(NOT ${GTEST_FOUND}) message(STATUS "Using bundled GoogleTest library.") add_subdirectory(googletest) + FetchContent_SetPopulated( + GTest + SOURCE_DIR googletest + BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/googletest + ) endif() add_subdirectory(protobuf-matchers) From 948b0bb902355c4ddbb829dc208be96bd5d47b01 Mon Sep 17 00:00:00 2001 From: David Sisson Date: Wed, 21 Feb 2024 08:48:51 -0800 Subject: [PATCH 12/18] Try using ExternalProject --- third_party/CMakeLists.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 08d99d18..a0e3f54b 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -12,11 +12,12 @@ add_subdirectory(fmt) find_package(GTest QUIET CONFIG) if(NOT ${GTEST_FOUND}) message(STATUS "Using bundled GoogleTest library.") - add_subdirectory(googletest) - FetchContent_SetPopulated( + include(ExternalProject) + ExternalProject_Add( GTest - SOURCE_DIR googletest + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/googletest BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/googletest + INSTALL_COMMAND "" ) endif() From 0ef66db8319eea8a86a188fdbe9a9a9499eec2d8 Mon Sep 17 00:00:00 2001 From: David Sisson Date: Wed, 21 Feb 2024 08:51:07 -0800 Subject: [PATCH 13/18] Now try FetchContent --- third_party/CMakeLists.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index a0e3f54b..92a48db2 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -11,14 +11,14 @@ add_subdirectory(fmt) find_package(GTest QUIET CONFIG) if(NOT ${GTEST_FOUND}) - message(STATUS "Using bundled GoogleTest library.") - include(ExternalProject) - ExternalProject_Add( - GTest - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/googletest - BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/googletest - INSTALL_COMMAND "" + message(STATUS "Retrieving external GoogleTest library.") + include(FetchContent) + FetchContent_Declare(GTest + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG v1.14.0 + OVERRIDE_FIND_PACKAGE ) + FetchContent_MakeAvailable(GTest) endif() add_subdirectory(protobuf-matchers) From 5527c8f3f5f27fed52ba05e9f2887a5936294145 Mon Sep 17 00:00:00 2001 From: David Sisson Date: Wed, 21 Feb 2024 09:14:31 -0800 Subject: [PATCH 14/18] Skip the CONFIG option. --- third_party/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 92a48db2..a0b54768 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -9,7 +9,7 @@ include(datetime.cmake) add_subdirectory(fmt) -find_package(GTest QUIET CONFIG) +find_package(GTest QUIET) if(NOT ${GTEST_FOUND}) message(STATUS "Retrieving external GoogleTest library.") include(FetchContent) From 19abdf1c0dc19593d69c3512e35c3ce5363691c0 Mon Sep 17 00:00:00 2001 From: David Sisson Date: Wed, 21 Feb 2024 09:28:27 -0800 Subject: [PATCH 15/18] Ran format --- third_party/CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index a0b54768..335169a9 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -13,11 +13,11 @@ find_package(GTest QUIET) if(NOT ${GTEST_FOUND}) message(STATUS "Retrieving external GoogleTest library.") include(FetchContent) - FetchContent_Declare(GTest - GIT_REPOSITORY https://github.com/google/googletest.git - GIT_TAG v1.14.0 - OVERRIDE_FIND_PACKAGE - ) + FetchContent_Declare( + GTest + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG v1.14.0 + OVERRIDE_FIND_PACKAGE) FetchContent_MakeAvailable(GTest) endif() From a97300abd8b972011929d845e25468afd3a65bfd Mon Sep 17 00:00:00 2001 From: David Sisson Date: Wed, 21 Feb 2024 09:36:50 -0800 Subject: [PATCH 16/18] Attempt to turn off build testing for protobuf-matchers. --- third_party/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 335169a9..1409d018 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -21,7 +21,10 @@ if(NOT ${GTEST_FOUND}) FetchContent_MakeAvailable(GTest) endif() +set(PREVIOUS_BUILD_TESTING ${BUILD_TESTING}) +set(BUILD_TESTING OFF) add_subdirectory(protobuf-matchers) +set(BUILD_TESTING ${PREVIOUS_BUILD_TESTING}) set(YAML_CPP_BUILD_TESTS OFF From 09ffe400b9e395beab797848762a62fcc1844d34 Mon Sep 17 00:00:00 2001 From: David Sisson Date: Wed, 21 Feb 2024 09:38:10 -0800 Subject: [PATCH 17/18] Remove the googletest submodule. --- .gitmodules | 3 --- third_party/googletest | 1 - 2 files changed, 4 deletions(-) delete mode 160000 third_party/googletest diff --git a/.gitmodules b/.gitmodules index 6da52c17..6a09c571 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,6 @@ [submodule "third_party/yaml-cpp"] path = third_party/yaml-cpp url = https://github.com/jbeder/yaml-cpp.git -[submodule "third_party/googletest"] - path = third_party/googletest - url = https://github.com/google/googletest.git [submodule "third_party/substrait"] path = third_party/substrait url = https://github.com/substrait-io/substrait.git diff --git a/third_party/googletest b/third_party/googletest deleted file mode 160000 index d9251171..00000000 --- a/third_party/googletest +++ /dev/null @@ -1 +0,0 @@ -Subproject commit d9251171f5a42eaf993395e7ef127546af5814b0 From ccd480fbc083f532d0e67a652c65622b5fbfe9dc Mon Sep 17 00:00:00 2001 From: David Sisson Date: Wed, 21 Feb 2024 09:40:31 -0800 Subject: [PATCH 18/18] Updated cmake format. --- third_party/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 1409d018..fb340296 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -13,12 +13,12 @@ find_package(GTest QUIET) if(NOT ${GTEST_FOUND}) message(STATUS "Retrieving external GoogleTest library.") include(FetchContent) - FetchContent_Declare( + fetchcontent_declare( GTest GIT_REPOSITORY https://github.com/google/googletest.git GIT_TAG v1.14.0 OVERRIDE_FIND_PACKAGE) - FetchContent_MakeAvailable(GTest) + fetchcontent_makeavailable(GTest) endif() set(PREVIOUS_BUILD_TESTING ${BUILD_TESTING})