Tags: cpm-cmake/CPM.cmake
Tags
replace deprecated calls to FetchContent_Populate (#570) * replace deprecated calls to FetchContent_Populate The single argument signature for FetchContent_Populate is deprecated with CMake 3.30. It was used, in order to call add_subdirectory manually with the EXCLUDE_FROM_ALL and SYSTEM flags. These have been added to FetchContent_Declare with 3.25 and 3.28. Calling FetchContent_MakeAvailable will internally call add_subdirectory with EXCLUDE_FROM_ALL and SYSTEM. There is therefore no need to call this manually. * fix: OPTIONS passed to CPMAddPackage not set where previously parsed in cpm_add_subdirectory which is not called on the new code path. * refactor: remove an unnecessary else branch * ci: include cmake 3.30 in test matrix * fix: forward SOURCE_SUBDIR to FetchContent_Declare For CMake version <3.28 this is done by calling add_subdirectory manually. For newer version FetchContent_Declare/MakeAvailable handles this for us. * fix: only set options if download_only is false this replicates the old behaviour * fix: DOWNLOAD_ONLY test * refactor: always use *_Populate to reduce code paths * Revert "refactor: always use *_Populate to reduce code paths" This reverts commit 0e8ca2a. --------- Co-authored-by: Avus <48911667 [email protected]>
Adding PATCHES keyword. (#558) * Adding PATCHES keyword. * Formatting fix. * Move cpm_add_patches() outside if/else scopes. * cmake-format: add PATCHES to CPMAddPackage. * Integration tests for PATCHES command. * Use get_filename_component() in place of cmake_path() for use with all cmake versions 3.14 and above. * Added an example and improved comment for cpm_add_patches.
Custom cache directory name (#543) * Custom cache directory name Enable setting a custom directory name for cached packages. Required if e.g. patch_command uses external variables or just to set a human readable name. * fixup! review comment CUSTOM_CACHE_DIR -> CUSTOM_CACHE_KEY * run cmake-format --------- Co-authored-by: Olsson Gerhard <[email protected]> Co-authored-by: Lars Melchior <[email protected]>
Use cpm_find_package to check if a package added (#552) If I have a project, which has: 1. /CMakeLists.txt: ```cmake cmake_minimum_required(VERSION 3.29) project(test) include(./cmake/CPM.cmake) add_subdirectory(subdir) cpmfindpackage( NAME nlohmann_json VERSION 3.11.2 URL "https://github.com/nlohmann/json/releases/download/v3.11.2/json.tar.xz" EXCLUDE_FROM_ALL ON) if(NOT TARGET nlohmann_json::nlohmann_json) message(FATAL_ERROR "BUG") endif() ``` 2. /subdir/CMakeLists.txt ```cmake cpmfindpackage( NAME nlohmann_json VERSION 3.11.2 URL "https://github.com/nlohmann/json/releases/download/v3.11.2/json.tar.xz" EXCLUDE_FROM_ALL ON) ``` When nlohmann_json is first founded by find_package, CPM.cmake register this package and later call to CPMFindPackage will not actually perform a find_package again, which leads to this buggy behavior. As CPM write a FindXXX.cmake file for packages added by CPM to pervert find_package to get local package, I think directly use cpm_find_package to check if a package is already added is good enough.
Treat relative paths as relative to parent project's remote (#522) * Treat relative paths as relative to parent project's remote * replace unit test case with integration test * run relative URL test only on supported CMake versions (3.27) * omit cmake 2.25.x test runner as replaced by 2.27.x --------- Co-authored-by: Chris Wright <[email protected]> Co-authored-by: Lars Melchior <[email protected]>
PreviousNext