Skip to content

Commit

Permalink
fix CI, cache ${package_name}_LIBRARIES
Browse files Browse the repository at this point in the history
  • Loading branch information
iGwkang committed Dec 30, 2024
1 parent 7c48a17 commit 260ddf7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
8 changes: 5 additions & 3 deletions example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 2 additions & 3 deletions scripts/test-unix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

1 change: 1 addition & 0 deletions xrepo.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 260ddf7

Please sign in to comment.