mirror of
https://github.com/threeal/cmake-action.git
synced 2025-06-08 18:21:20 +00:00
commit
f60f3407cc
38
.github/workflows/test.yml
vendored
38
.github/workflows/test.yml
vendored
@ -21,27 +21,13 @@ jobs:
|
|||||||
- name: Run build result
|
- name: Run build result
|
||||||
run: ${{ matrix.os == 'windows-latest' && 'build\Debug\hello_world.exe' || 'build/hello_world' }}
|
run: ${{ matrix.os == 'windows-latest' && 'build\Debug\hello_world.exe' || 'build/hello_world' }}
|
||||||
|
|
||||||
use-action-with-specified-source-dir:
|
use-action-with-specified-dir:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v3.3.0
|
uses: actions/checkout@v3.3.0
|
||||||
|
|
||||||
- name: Use this action with specified source directory
|
- name: Use this action with specified directory
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
source-dir: test
|
|
||||||
|
|
||||||
- name: Run build result
|
|
||||||
run: build/hello_world
|
|
||||||
|
|
||||||
use-action-with-specified-build-dir:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v3.3.0
|
|
||||||
|
|
||||||
- name: Use this action with specified build directory
|
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
source-dir: test
|
source-dir: test
|
||||||
@ -50,7 +36,7 @@ jobs:
|
|||||||
- name: Run build result
|
- name: Run build result
|
||||||
run: test/build/hello_world
|
run: test/build/hello_world
|
||||||
|
|
||||||
- name: Check if default build directory is not exist
|
- name: Check if the default build directory does not exist
|
||||||
run: test ! -d build
|
run: test ! -d build
|
||||||
|
|
||||||
use-action-with-specified-compiler:
|
use-action-with-specified-compiler:
|
||||||
@ -86,21 +72,3 @@ jobs:
|
|||||||
|
|
||||||
- name: Run build result
|
- name: Run build result
|
||||||
run: build/${{ matrix.lang == 'C' && 'hello_world_c' || 'hello_world' }}
|
run: build/${{ matrix.lang == 'C' && 'hello_world_c' || 'hello_world' }}
|
||||||
|
|
||||||
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
|
|
||||||
|
@ -3,7 +3,6 @@ project(test)
|
|||||||
|
|
||||||
option(BUILD_C "build hello world in C Language" OFF)
|
option(BUILD_C "build hello world in C Language" OFF)
|
||||||
option(BUILD_CXX "build hello world in CXX Language" ON)
|
option(BUILD_CXX "build hello world in CXX Language" ON)
|
||||||
option(BUILD_TXT "build hello world txt file" OFF)
|
|
||||||
|
|
||||||
if(BUILD_C)
|
if(BUILD_C)
|
||||||
add_executable(hello_world_c hello_world.c)
|
add_executable(hello_world_c hello_world.c)
|
||||||
@ -12,10 +11,3 @@ endif()
|
|||||||
if(BUILD_CXX)
|
if(BUILD_CXX)
|
||||||
add_executable(hello_world hello_world.cpp)
|
add_executable(hello_world hello_world.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
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