mirror of
https://github.com/threeal/cmake-action.git
synced 2025-04-22 11:31:21 +00:00
Merge pull request #12 from threeal/add-args-input
Add Other Arguments Input
This commit is contained in:
commit
c6d2f05891
18
.github/workflows/test.yml
vendored
18
.github/workflows/test.yml
vendored
@ -52,3 +52,21 @@ jobs:
|
||||
|
||||
- name: Check if default build directory is not exist
|
||||
run: test ! -d build
|
||||
|
||||
use-action-with-additional-args:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3.3.0
|
||||
|
||||
- name: Use this action with build txt enabled
|
||||
uses: ./
|
||||
with:
|
||||
source-dir: test
|
||||
args: -D BUILD_TXT=ON
|
||||
|
||||
- name: Run build result
|
||||
run: build/hello_world
|
||||
|
||||
- name: Check if the txt result exist
|
||||
run: cat build/hello_world.txt
|
||||
|
@ -13,6 +13,9 @@ inputs:
|
||||
description: The build directory of CMake project
|
||||
required: false
|
||||
default: build
|
||||
args:
|
||||
description: Additional arguments passed during CMake configuration
|
||||
required: false
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
@ -21,6 +24,9 @@ runs:
|
||||
run: |
|
||||
CONFIGURE_ARGS="${{ inputs.source-dir }} -B ${{ inputs.build-dir }}"
|
||||
BUILD_ARGS="--build ${{ inputs.build-dir }}"
|
||||
if [ -n '${{ inputs.args }}' ]; then
|
||||
CONFIGURE_ARGS="$CONFIGURE_ARGS ${{ inputs.args }}"
|
||||
fi
|
||||
echo "CMAKE_CONFIGURE_ARGS=$CONFIGURE_ARGS" >> $GITHUB_ENV
|
||||
echo "CMAKE_BUILD_ARGS=$BUILD_ARGS" >> $GITHUB_ENV
|
||||
|
||||
|
@ -1,3 +1,13 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(test)
|
||||
|
||||
option(BUILD_TXT "build hello world txt file" OFF)
|
||||
|
||||
add_executable(hello_world hello_world.cpp)
|
||||
|
||||
if(BUILD_TXT)
|
||||
add_custom_target(
|
||||
hello_world_txt ALL
|
||||
COMMAND echo "Hello world!" >> ${CMAKE_CURRENT_BINARY_DIR}/hello_world.txt
|
||||
)
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user