File 0001-Disable-CPM-CMake-Package-Manager.patch of Package ada-url
From 290151d4acae45d880feb3f72d68d1e39a4f8a74 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= <bjorn.bidar@thaodan.de>
Date: Sat, 2 Nov 2024 14:09:14 +0200
Subject: [PATCH] Disable CPM - CMake Package Manager
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The project tries to download CPM through FetchContent which isn't an
option.
But even when that would succeeded we don't want to use vendored
dependencies which would be fetched through this package manager.
Simply disable CPM and do the find_package calls ourself.
Signed-off-by: Björn Bidar <bjorn.bidar@thaodan.de>
Upstream: no
---
CMakeLists.txt | 45 +++++++---------------------------------
tools/cli/CMakeLists.txt | 8 ++-----
2 files changed, 9 insertions(+), 44 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f0acf569..e90de8ec 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,3 +1,4 @@
+
cmake_minimum_required(VERSION 3.16)
project(ada
@@ -26,45 +27,18 @@ option(ADA_USE_SIMDUTF "Whether to use SIMDUTF for IDNA" OFF)
# errors due to CPM, so this is here to support disabling all the testing
# and tooling for ada if one only wishes to use the ada library.
if(ADA_TESTING OR ADA_BENCHMARKS OR ADA_TOOLS OR ADA_USE_SIMDUTF)
- include(cmake/CPM.cmake)
# CPM requires git as an implicit dependency
# We use googletest in the tests
if(ADA_TESTING)
- CPMAddPackage(
- NAME GTest
- GITHUB_REPOSITORY google/googletest
- VERSION 1.15.2
- OPTIONS "BUILD_GMOCK OFF" "INSTALL_GTEST OFF"
- )
+ find_package(GTest)
endif()
# We use simdjson in both the benchmarks and tests
if(ADA_TESTING OR ADA_BENCHMARKS)
- CPMAddPackage("gh:simdjson/simdjson@3.10.1")
+ find_package("simdjson" REQUIRED)
endif()
# We use Google Benchmark, but it does not build under several 32-bit systems.
if(ADA_BENCHMARKS AND (CMAKE_SIZEOF_VOID_P EQUAL 8))
- if(DEFINED CODSPEED_MODE)
- message(STATUS "Using CodSpeed-instrumented Google Benchmark")
- CPMAddPackage(
- NAME benchmark
- GITHUB_REPOSITORY CodSpeedHQ/codspeed-cpp
- VERSION 2.0.0
- SOURCE_SUBDIR google_benchmark
- OPTIONS "BENCHMARK_ENABLE_TESTING OFF"
- "BENCHMARK_ENABLE_INSTALL OFF"
- "BENCHMARK_ENABLE_WERROR OFF"
- )
- else()
- message(STATUS "Using standard Google Benchmark")
- CPMAddPackage(
- NAME benchmark
- GITHUB_REPOSITORY google/benchmark
- VERSION 1.9.0
- OPTIONS "BENCHMARK_ENABLE_TESTING OFF"
- "BENCHMARK_ENABLE_INSTALL OFF"
- "BENCHMARK_ENABLE_WERROR OFF"
- )
- endif()
+ find_package(benchmark REQUIRED)
endif()
if (ADA_TESTING AND NOT EMSCRIPTEN)
@@ -90,15 +64,10 @@ if(ADA_TESTING OR ADA_BENCHMARKS OR ADA_TOOLS OR ADA_USE_SIMDUTF)
if (ADA_TESTING AND EMSCRIPTEN)
add_subdirectory(tests/wasm)
endif(ADA_TESTING AND EMSCRIPTEN)
+endif()
- if(ADA_USE_SIMDUTF)
- CPMAddPackage(
- NAME simdutf
- GITHUB_REPOSITORY simdutf/simdutf
- VERSION 7.3.2
- OPTIONS "SIMDUTF_TESTS OFF" "SIMDUTF_TOOLS OFF"
- )
- endif()
+if(ADA_USE_SIMDUTF)
+ find_package(simdutf)
endif()
add_library(ada::ada ALIAS ada)
diff --git a/tools/cli/CMakeLists.txt b/tools/cli/CMakeLists.txt
index 5e7ffe01..b2dd87d4 100644
--- a/tools/cli/CMakeLists.txt
+++ b/tools/cli/CMakeLists.txt
@@ -37,12 +37,8 @@ if(MSVC AND BUILD_SHARED_LIBS)
"$<TARGET_FILE:ada>" # <--this is in-file
"$<TARGET_FILE_DIR:adaparse>") # <--this is out-file path
endif()
-CPMAddPackage("gh:fmtlib/fmt#11.0.2")
-CPMAddPackage(
- GITHUB_REPOSITORY jarro2783/cxxopts
- VERSION 3.2.0
- OPTIONS "CXXOPTS_BUILD_EXAMPLES NO" "CXXOPTS_BUILD_TESTS NO" "CXXOPTS_ENABLE_INSTALL YES"
-)
+find_package(fmt)
+find_package(cxxopts)
target_link_libraries(adaparse PRIVATE cxxopts::cxxopts fmt::fmt)
if(MSVC OR MINGW)
--
2.52.0