Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switching to CPM #523

Merged
merged 1 commit into from
Oct 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/tools/cmake")
find_package(CTargets)
find_package(Options)
find_package(LTO)
include(Import)
include(cmake/CPM.cmake)

configure_file("${CMAKE_CURRENT_SOURCE_DIR}/roaring.pc.in"
"${CMAKE_CURRENT_BINARY_DIR}/roaring.pc" @ONLY)
Expand Down
24 changes: 24 additions & 0 deletions cmake/CPM.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# SPDX-License-Identifier: MIT
#
# SPDX-FileCopyrightText: Copyright (c) 2019-2023 Lars Melchior and contributors

set(CPM_DOWNLOAD_VERSION 0.38.6)
set(CPM_HASH_SUM "11c3fa5f1ba14f15d31c2fb63dbc8628ee133d81c8d764caad9a8db9e0bacb07")

if(CPM_SOURCE_CACHE)
set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
elseif(DEFINED ENV{CPM_SOURCE_CACHE})
set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
else()
set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
endif()

# Expand relative path. This is important if the provided path contains a tilde (~)
get_filename_component(CPM_DOWNLOAD_LOCATION ${CPM_DOWNLOAD_LOCATION} ABSOLUTE)

file(DOWNLOAD
https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
${CPM_DOWNLOAD_LOCATION} EXPECTED_HASH SHA256=${CPM_HASH_SUM}
)

include(${CPM_DOWNLOAD_LOCATION})
52 changes: 0 additions & 52 deletions cmake/import.cmake

This file was deleted.

11 changes: 9 additions & 2 deletions microbenchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,15 @@ set_off(BENCHMARK_ENABLE_TESTING)
set_off(BENCHMARK_ENABLE_INSTALL)
set_off(BENCHMARK_ENABLE_WERROR)
set(BENCHMARK_ENABLE_WERROR OFF)
import_dependency(google_benchmarks google/benchmark 3441176)
add_dependency(google_benchmarks)
CPMAddPackage(
NAME benchmark
GITHUB_REPOSITORY google/benchmark
GIT_TAG 3441176
OPTIONS "BENCHMARK_ENABLE_TESTING OFF"
"BENCHMARK_ENABLE_INSTALL OFF"
"BENCHMARK_ENABLE_WERROR OFF"

)

add_executable(bench bench.cpp)
target_link_libraries(bench PRIVATE roaring)
Expand Down
7 changes: 5 additions & 2 deletions tools/cmake/FindCTargets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ endif ()
include(${PROJECT_SOURCE_DIR}/tools/cmake/Import.cmake)
set(BUILD_STATIC_LIB ON)
if (ENABLE_ROARING_TESTS)
import_dependency(cmocka clibs/cmocka f5e2cd7)
add_dependency(cmocka)
CPMAddPackage(
NAME cmocka
GITHUB_REPOSITORY clibs/cmocka
GIT_TAG f5e2cd7
)
endif()

function(add_c_test TEST_NAME)
Expand Down