Skip to content

Commit 77c30bc

Browse files
committed
Fixing force init for CI and simplifying CI template.
1 parent 832313c commit 77c30bc

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

cmake/cpp-library-ci.cmake

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,12 @@
55
# This module handles GitHub Actions workflow generation with PROJECT_NAME substitution
66

77
# Function to configure CI workflow template
8-
function(_cpp_library_setup_ci)
9-
set(options FORCE_INIT)
10-
cmake_parse_arguments(ARG "${options}" "" "" ${ARGN})
11-
8+
# Arguments: force_init (boolean) - whether to overwrite existing file
9+
function(_cpp_library_setup_ci force_init)
1210
set(ci_template "${CPP_LIBRARY_ROOT}/templates/.github/workflows/ci.yml.in")
1311
set(ci_dest "${CMAKE_CURRENT_SOURCE_DIR}/.github/workflows/ci.yml")
1412

15-
if(EXISTS "${ci_template}" AND (NOT EXISTS "${ci_dest}" OR ARG_FORCE_INIT))
13+
if(EXISTS "${ci_template}" AND (NOT EXISTS "${ci_dest}" OR force_init))
1614
get_filename_component(ci_dir "${ci_dest}" DIRECTORY)
1715
file(MAKE_DIRECTORY "${ci_dir}")
1816
configure_file("${ci_template}" "${ci_dest}" @ONLY)

templates/.github/workflows/ci.yml.in

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,22 +73,21 @@ jobs:
7373
mkdir -p ${{ runner.temp }}/test-find-package
7474
cd ${{ runner.temp }}/test-find-package
7575

76-
# Convert paths to forward slashes for CMake (works on all platforms)
77-
INSTALL_PREFIX=$(echo "${{ runner.temp }}/install" | sed 's|\\|/|g')
78-
7976
# Create test CMakeLists.txt
8077
cat > CMakeLists.txt << EOF
8178
cmake_minimum_required(VERSION 3.20)
8279
project(test-find-package CXX)
8380

84-
set(CMAKE_PREFIX_PATH "${INSTALL_PREFIX}")
8581
find_package(@PROJECT_NAME@ REQUIRED)
8682

8783
message(STATUS "Successfully found @PROJECT_NAME@")
8884
EOF
8985

90-
# Test find_package
91-
cmake -B build -S .
86+
# Convert paths to forward slashes for CMake (works on all platforms)
87+
INSTALL_PREFIX=$(echo "${{ runner.temp }}/install" | sed 's|\\|/|g')
88+
89+
# Test find_package with CMAKE_PREFIX_PATH
90+
cmake -B build -S . -DCMAKE_PREFIX_PATH="${INSTALL_PREFIX}"
9291

9392
clang-tidy:
9493
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)