mirror of
https://github.com/cpm-cmake/CPM.cmake.git
synced 2025-11-18 07:07:47 -05:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
33efd5f5d2 | ||
|
|
4b3a60fb32 | ||
|
|
cd28d445ae | ||
|
|
2a9e203320 | ||
|
|
22381df399 | ||
|
|
c3807eb774 |
@@ -80,6 +80,7 @@ On the other hand, if `VERSION` hasn't been explicitly specified, CPM can automa
|
||||
`GIT_TAG` can also be set to a specific commit or a branch name such as `master`, however this isn't recommended, as such packages will only be updated when the cache is cleared.
|
||||
|
||||
`PATCHES` takes a list of patch files to apply sequentially. For a basic example, see [Highway](examples/highway/CMakeLists.txt).
|
||||
We recommend that if you use `PATCHES`, you also set `CPM_SOURCE_CACHE`. See [issue 577](https://github.com/cpm-cmake/CPM.cmake/issues/577).
|
||||
|
||||
If an additional optional parameter `EXCLUDE_FROM_ALL` is set to a truthy value, then any targets defined inside the dependency won't be built by default. See the [CMake docs](https://cmake.org/cmake/help/latest/prop_tgt/EXCLUDE_FROM_ALL.html) for details.
|
||||
|
||||
|
||||
@@ -277,10 +277,10 @@ function(cpm_create_module_file Name)
|
||||
# https://cmake.org/cmake/help/latest/module/FetchContent.html#fetchcontent-find-package-integration-examples
|
||||
string(TOLOWER ${Name} NameLower)
|
||||
file(WRITE ${CMAKE_FIND_PACKAGE_REDIRECTS_DIR}/${NameLower}-config.cmake
|
||||
"include(\"${CMAKE_CURRENT_LIST_DIR}/${NameLower}-extra.cmake\" OPTIONAL)\n"
|
||||
"include(\"${CMAKE_CURRENT_LIST_DIR}/${Name}Extra.cmake\" OPTIONAL)\n"
|
||||
"include(\"\${CMAKE_CURRENT_LIST_DIR}/${NameLower}-extra.cmake\" OPTIONAL)\n"
|
||||
"include(\"\${CMAKE_CURRENT_LIST_DIR}/${Name}Extra.cmake\" OPTIONAL)\n"
|
||||
)
|
||||
file(WRITE ${CMAKE_FIND_PACKAGE_REDIRECTS_DIR}/${NameLower}-version.cmake
|
||||
file(WRITE ${CMAKE_FIND_PACKAGE_REDIRECTS_DIR}/${NameLower}-config-version.cmake
|
||||
"set(PACKAGE_VERSION_COMPATIBLE TRUE)\n" "set(PACKAGE_VERSION_EXACT TRUE)\n"
|
||||
)
|
||||
else()
|
||||
@@ -490,7 +490,7 @@ function(cpm_add_patches)
|
||||
|
||||
# Find the patch program.
|
||||
find_program(PATCH_EXECUTABLE patch)
|
||||
if(WIN32 AND NOT PATCH_EXECUTABLE)
|
||||
if(CMAKE_HOST_WIN32 AND NOT PATCH_EXECUTABLE)
|
||||
# The Windows git executable is distributed with patch.exe. Find the path to the executable, if
|
||||
# it exists, then search `../usr/bin` and `../../usr/bin` for patch.exe.
|
||||
find_package(Git QUIET)
|
||||
@@ -884,8 +884,9 @@ function(CPMAddPackage)
|
||||
# Calling FetchContent_MakeAvailable will then internally forward these options to
|
||||
# add_subdirectory. Up until these changes, we had to call FetchContent_Populate and
|
||||
# add_subdirectory separately, which is no longer necessary and has been deprecated as of 3.30.
|
||||
# A Bug in CMake prevents us to use the non-deprecated functions until 3.30.3.
|
||||
set(fetchContentDeclareExtraArgs "")
|
||||
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.28.0")
|
||||
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.30.3")
|
||||
if(${CPM_ARGS_EXCLUDE_FROM_ALL})
|
||||
list(APPEND fetchContentDeclareExtraArgs EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
@@ -911,7 +912,7 @@ function(CPMAddPackage)
|
||||
if(CPM_SOURCE_CACHE AND download_directory)
|
||||
file(LOCK ${download_directory}/../cmake.lock RELEASE)
|
||||
endif()
|
||||
if(${populated} AND ${CMAKE_VERSION} VERSION_LESS "3.28.0")
|
||||
if(${populated} AND ${CMAKE_VERSION} VERSION_LESS "3.30.3")
|
||||
cpm_add_subdirectory(
|
||||
"${CPM_ARGS_NAME}"
|
||||
"${DOWNLOAD_ONLY}"
|
||||
@@ -1113,7 +1114,7 @@ function(cpm_fetch_package PACKAGE DOWNLOAD_ONLY populated)
|
||||
string(TOLOWER "${PACKAGE}" lower_case_name)
|
||||
|
||||
if(NOT ${lower_case_name}_POPULATED)
|
||||
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.28.0")
|
||||
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.30.3")
|
||||
if(DOWNLOAD_ONLY)
|
||||
# MakeAvailable will call add_subdirectory internally which is not what we want when
|
||||
# DOWNLOAD_ONLY is set. Populate will only download the dependency without adding it to the
|
||||
|
||||
@@ -13,10 +13,12 @@ include(../../cmake/CPM.cmake)
|
||||
|
||||
CPMAddPackage(
|
||||
NAME Boost
|
||||
VERSION 1.84.0
|
||||
URL https://github.com/boostorg/boost/releases/download/boost-1.84.0/boost-1.84.0.tar.xz
|
||||
URL_HASH SHA256=2e64e5d79a738d0fa6fb546c6e5c2bd28f88d268a2a080546f74e5ff98f29d0e
|
||||
OPTIONS "BOOST_ENABLE_CMAKE ON" "BOOST_INCLUDE_LIBRARIES container\\\;asio" # Note the escapes!
|
||||
VERSION 1.86.0 # Versions less than 1.85.0 may need patches for installation targets.
|
||||
URL https://github.com/boostorg/boost/releases/download/boost-1.86.0/boost-1.86.0-cmake.tar.xz
|
||||
URL_HASH SHA256=2c5ec5edcdff47ff55e27ed9560b0a0b94b07bd07ed9928b476150e16b0efc57
|
||||
OPTIONS "BOOST_ENABLE_CMAKE ON" "BOOST_SKIP_INSTALL_RULES ON" # Set `OFF` for installation
|
||||
"BUILD_SHARED_LIBS OFF" "BOOST_INCLUDE_LIBRARIES container\\\;asio" # Note the escapes!
|
||||
)
|
||||
|
||||
# `Boost::headers` is also valid
|
||||
target_link_libraries(CPMExampleBoost PRIVATE Boost::asio Boost::container)
|
||||
|
||||
@@ -8,7 +8,7 @@ include(../../cmake/CPM.cmake)
|
||||
|
||||
CPMAddPackage(
|
||||
NAME lua
|
||||
GIT_REPOSITORY https://github.com/lua/lua.git
|
||||
GITHUB_REPOSITORY lua/lua
|
||||
VERSION 5.3.5
|
||||
DOWNLOAD_ONLY YES
|
||||
)
|
||||
@@ -21,7 +21,13 @@ if(lua_ADDED)
|
||||
target_include_directories(lua SYSTEM PUBLIC $<BUILD_INTERFACE:${lua_SOURCE_DIR}>)
|
||||
endif()
|
||||
|
||||
CPMAddPackage("gh:ThePhD/sol2@3.3.0")
|
||||
CPMAddPackage(
|
||||
NAME sol2
|
||||
GITHUB_REPOSITORY ThePhD/sol2
|
||||
VERSION 3.3.0
|
||||
# fix for clang 18.1.0, see https://github.com/ThePhD/sol2/issues/1581#issuecomment-2103463524
|
||||
PATCHES fix_for_clang.patch
|
||||
)
|
||||
|
||||
# ---- Executable ----
|
||||
|
||||
|
||||
18
examples/sol2/fix_for_clang.patch
Normal file
18
examples/sol2/fix_for_clang.patch
Normal file
@@ -0,0 +1,18 @@
|
||||
diff -u a/include/sol/function_types_stateless.hpp b/include/types/function_types_stateless.hpp
|
||||
--- a/include/sol/function_types_stateless.hpp
|
||||
+++ b/include/sol/function_types_stateless.hpp
|
||||
@@ -322,7 +322,13 @@ namespace sol { namespace function_detail {
|
||||
}
|
||||
|
||||
template <bool is_yielding, bool no_trampoline>
|
||||
- static int call(lua_State* L) noexcept(std::is_nothrow_copy_assignable_v<T>) {
|
||||
+ static int call(lua_State* L)
|
||||
+#if SOL_IS_ON(SOL_COMPILER_CLANG)
|
||||
+ // apparent regression in clang 18 - llvm/llvm-project#91362
|
||||
+#else
|
||||
+ noexcept(std::is_nothrow_copy_assignable_v<T>)
|
||||
+#endif
|
||||
+ {
|
||||
int nr;
|
||||
if constexpr (no_trampoline) {
|
||||
nr = real_call(L);
|
||||
Reference in New Issue
Block a user