You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Configure, build, and test your [CMake](https://cmake.org/) project using [GitHub Actions](https://github.com/features/actions). This action simplifies the workflow for your CMake project. It configures the build environment using the `cmake` command, builds the project using the `cmake --build` command, and optionally tests the project using the `ctest` command.
7
+
Configure, build, and test your [CMake](https://cmake.org/) project using [GitHub Actions](https://github.com/features/actions). This action simplifies the workflow for your CMake project. It configures the build environment using the `cmake` command, and optionally builds the project using the `cmake --build` command and tests the project using the `ctest` command.
8
8
9
9
## Features
10
10
11
-
- Configures and builds a project using the [cmake](https://cmake.org/cmake/help/latest/manual/cmake.1.html) command.
12
-
- Option to test a project using the [ctest](https://cmake.org/cmake/help/latest/manual/ctest.1.html) command.
11
+
- Configures a project using the [`cmake`](https://cmake.org/cmake/help/latest/manual/cmake.1.html) command.
12
+
- Option to build a project using the `cmake --build` command.
13
+
- Option to test a project using the [`ctest`](https://cmake.org/cmake/help/latest/manual/ctest.1.html) command.
13
14
- Auto-detects and installs required dependencies.
14
15
- Supports specifying multiple CMake options directly from the Action inputs.
15
16
@@ -21,17 +22,18 @@ For more information, refer to [action.yml](./action.yml) and the [GitHub Action
21
22
22
23
| Name | Value Type | Description |
23
24
| --- | --- | --- |
24
-
|`source-dir`| Path | Source directory of the CMake project. Defaults to the current directory. |
25
-
|`build-dir`| Path | Build directory of the CMake project. Defaults to the `build` directory inside the source directory. |
26
-
|`targets`| Multiple strings | List of build targets. |
27
-
|`run-test`|`true` or `false`| If enabled, runs testing using [CTest](https://cmake.org/cmake/help/latest/manual/ctest.1.html). Defaults to `false`. |
28
-
|`generator`| String | Build system generator for the CMake project. |
29
-
|`c-compiler`| String | Preferred executable for compiling C language files. |
30
-
|`cxx-compiler`| String | Preferred executable for compiling C++ language files. |
31
-
|`c-flags`| Multiple strings | Additional flags passed when compiling C language files. |
32
-
|`cxx-flags`| Multiple strings | Additional flags passed when compiling C++ language files. |
|`test-args`| Multiple strings | Additional arguments passed during the CTest run. |
25
+
|`source-dir`| Path | The source directory of the CMake project. It defaults to the current directory. |
26
+
|`build-dir`| Path | The build directory of the CMake project. It defaults to the `build` directory inside the source directory. |
27
+
|`generator`| String | The build system generator for the CMake project. |
28
+
|`c-compiler`| String | The preferred executable for compiling C language files. |
29
+
|`cxx-compiler`| String | The preferred executable for compiling C++ language files. |
30
+
|`c-flags`| Multiple strings | Additional flags to pass when compiling C language files. |
31
+
|`cxx-flags`| Multiple strings | Additional flags to pass when compiling C++ language files. |
32
+
|`args`| Multiple strings | Additional arguments to pass during the CMake configuration. |
33
+
|`run-build`|`true` or `false`| If enabled, it builds the project using [CTest](https://cmake.org/cmake/help/latest/manual/ctest.1.html). It defaults to `false`. |
34
+
|`build-args`| Multiple strings | Additional arguments to pass during the CMake build. |
35
+
|`run-test`|`true` or `false`| If enabled, it runs testing using [CTest](https://cmake.org/cmake/help/latest/manual/ctest.1.html). It defaults to `false`. |
36
+
|`test-args`| Multiple strings | Additional arguments to pass during the CTest run. |
35
37
36
38
> Note: Multiple strings mean that the input can be specified with more than one value. Separate each value with a space or a new line.
> Note: You can replace `@latest` with any version you prefer. See [this](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsuses).
58
66
59
67
#### Specify the Source and Build Directories
60
68
61
69
```yaml
62
-
- name: Configure and build this project
70
+
- name: Configure the project
63
71
uses: threeal/cmake-action@latest
64
72
with:
65
73
source-dir: submodules
66
74
build-dir: submodules/out
67
75
```
68
76
69
-
#### Specify the Build Targets
70
-
71
-
```yaml
72
-
- name: Configure and build this project
73
-
uses: threeal/cmake-action@latest
74
-
with:
75
-
targets: hello_mars hello_sun
76
-
```
77
-
78
-
#### Run Unit Tests After Build
77
+
#### Configure, Build, and Test in the Same Step
79
78
80
79
```yaml
81
-
- name: Configure, build, and test this project
80
+
- name: Configure, build, and test the project
82
81
uses: threeal/cmake-action@latest
83
82
with:
84
83
args: -DBUILD_TESTING=ON
84
+
run-build: true
85
85
run-test: true
86
86
```
87
87
88
88
#### Using Ninja as the Generator and Clang as the Compiler
0 commit comments