From 260ddf7c30d8461c60d2cd818d851c4fb3aef81d Mon Sep 17 00:00:00 2001 From: Gwkang <975500206@qq.com> Date: Mon, 30 Dec 2024 16:55:47 +0800 Subject: [PATCH] fix CI, cache ${package_name}_LIBRARIES --- example/CMakeLists.txt | 8 +++++--- scripts/test-unix.sh | 5 ++--- xrepo.cmake | 1 + 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index c750775..9d1e9fa 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -3,16 +3,18 @@ cmake_minimum_required(VERSION 3.13.0) project(example LANGUAGES C CXX ASM) # Download xrepo.cmake if not exists in build directory. -if(NOT EXISTS "${CMAKE_BINARY_DIR}/xrepo.cmake") +# You should use "${CMAKE_BINARY_DIR}/xrepo.cmake" +if(NOT EXISTS "../xrepo.cmake") message(STATUS "Downloading xrepo.cmake from https://github.com/xmake-io/xrepo-cmake/") # mirror https://cdn.jsdelivr.net/gh/xmake-io/xrepo-cmake@main/xrepo.cmake file(DOWNLOAD "https://raw.githubusercontent.com/xmake-io/xrepo-cmake/main/xrepo.cmake" - "${CMAKE_BINARY_DIR}/xrepo.cmake" + "../xrepo.cmake" TLS_VERIFY ON) endif() # Include xrepo.cmake so we can use xrepo_package function. -include(${CMAKE_BINARY_DIR}/xrepo.cmake) +# You should use "${CMAKE_BINARY_DIR}/xrepo.cmake" +include(../xrepo.cmake) # Call `xrepo_package` function to use default pcre2 xrepo_package("pcre2" MODE debug) diff --git a/scripts/test-unix.sh b/scripts/test-unix.sh index a38195b..765892e 100755 --- a/scripts/test-unix.sh +++ b/scripts/test-unix.sh @@ -11,14 +11,14 @@ cmake -DXREPO_PACKAGE_VERBOSE=ON example | tee $output grep -E 'mode=debug pcre2' $output grep -E "pcre2_INCLUDE_DIRS" $output grep -E "pcre2_LIBRARY_DIRS" $output -grep -E "pcre2_LIBRARIES" $output +grep -E "pcre2_LINK_LIBRARIES" $output grep -E "pcre2_DEFINITIONS" $output grep -E "gflags prepend to CMAKE_PREFIX_PATH" $output grep -E "glog prepend to CMAKE_PREFIX_PATH" $output grep -E "zlib_INCLUDE_DIRS" $output grep -E "zlib prepend to CMAKE_PREFIX_PATH" $output grep -E "pkg_check_modules pcre2_CFLAGS.*packages/p/pcre2" $output -grep -E "target_link_libraries\(example-bin PRIVATE pcre2-posix;pcre2-8\)" $output +grep -E "target_link_libraries\(example-bin PRIVATE .*pcre2-posix.a;.*pcre2-8.a\)" $output grep -v -E "xrepo: target_link_libraries\(example-bin PRIVATE z\)" $output make @@ -42,4 +42,3 @@ grep -E "pcre2 $match_cached_output" $output grep -E "gflags 2.2.2 $match_cached_output" $output grep -E "example/packages/glog.lua" $output grep -E "myzlib $match_cached_output" $output - diff --git a/xrepo.cmake b/xrepo.cmake index 10771e1..802f3c8 100644 --- a/xrepo.cmake +++ b/xrepo.cmake @@ -619,6 +619,7 @@ macro(_xrepo_fetch_json) if(DEFINED links) set(${package_name}_LINK_LIBRARIES "${links}" CACHE INTERNAL "") + set(${package_name}_LIBRARIES "${links}" CACHE INTERNAL "") list(APPEND xrepo_vars_${package_name} ${package_name}_LINK_LIBRARIES) message(STATUS "xrepo: ${package_name}_LINK_LIBRARIES ${${package_name}_LINK_LIBRARIES}") else()