mirror of
				https://github.com/threeal/cmake-action.git
				synced 2025-11-03 21:33:42 +00:00 
			
		
		
		
	
						commit
						5be43ab87e
					
				
							
								
								
									
										34
									
								
								.github/workflows/test.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										34
									
								
								.github/workflows/test.yml
									
									
									
									
										vendored
									
									
								
							@ -31,16 +31,18 @@ jobs:
 | 
				
			|||||||
        uses: ./
 | 
					        uses: ./
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          source-dir: test
 | 
					          source-dir: test
 | 
				
			||||||
          build-dir: test/build
 | 
					          build-dir: output
 | 
				
			||||||
 | 
					          run-test: true
 | 
				
			||||||
      - name: Run the build result
 | 
					          test-args: -R hello_world
 | 
				
			||||||
        run: test/build/hello_world
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
      - name: Check if the default build directory does not exist
 | 
					      - name: Check if the default build directory does not exist
 | 
				
			||||||
        run: test ! -d build
 | 
					        run: test ! -d build && test ! -d test/build
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  additional-flags-usage:
 | 
					  additional-flags-usage:
 | 
				
			||||||
    runs-on: ubuntu-latest
 | 
					    runs-on: ${{ matrix.compiler == 'msvc' && 'windows' || 'ubuntu' }}-latest
 | 
				
			||||||
 | 
					    strategy:
 | 
				
			||||||
 | 
					      matrix:
 | 
				
			||||||
 | 
					        compiler: [gcc, msvc]
 | 
				
			||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
      - name: Check out this repository
 | 
					      - name: Check out this repository
 | 
				
			||||||
        uses: actions/checkout@v3.3.0
 | 
					        uses: actions/checkout@v3.3.0
 | 
				
			||||||
@ -50,11 +52,11 @@ jobs:
 | 
				
			|||||||
        with:
 | 
					        with:
 | 
				
			||||||
          source-dir: test
 | 
					          source-dir: test
 | 
				
			||||||
          targets: test_c test_cpp
 | 
					          targets: test_c test_cpp
 | 
				
			||||||
          c-flags: -Wno-unused-variable
 | 
					          run-test: true
 | 
				
			||||||
          cxx-flags: -Wno-unused-variable
 | 
					          c-flags: ${{ matrix.compiler == 'msvc' && '/w /WX-' || '-Wno-unused-variable' }}
 | 
				
			||||||
 | 
					          cxx-flags: ${{ matrix.compiler == 'msvc' && '/w /WX-' || '-Wno-unused-variable' }}
 | 
				
			||||||
      - name: Run the build results
 | 
					          args: -D CHECK_SURPASS_WARNING=ON
 | 
				
			||||||
        run: build/test_c && build/test_cpp
 | 
					          test-args: -R test ${{ matrix.compiler == 'msvc' && '-C Debug' || '' }}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  specified-compiler-usage:
 | 
					  specified-compiler-usage:
 | 
				
			||||||
    runs-on: ${{ matrix.os }}-latest
 | 
					    runs-on: ${{ matrix.os }}-latest
 | 
				
			||||||
@ -70,13 +72,12 @@ jobs:
 | 
				
			|||||||
        with:
 | 
					        with:
 | 
				
			||||||
          source-dir: test
 | 
					          source-dir: test
 | 
				
			||||||
          targets: test_c test_cpp
 | 
					          targets: test_c test_cpp
 | 
				
			||||||
 | 
					          run-test: true
 | 
				
			||||||
          generator: Ninja
 | 
					          generator: Ninja
 | 
				
			||||||
          c-compiler: clang
 | 
					          c-compiler: clang
 | 
				
			||||||
          cxx-compiler: clang++
 | 
					          cxx-compiler: clang++
 | 
				
			||||||
          args: -D CHECK_USING_CLANG=ON
 | 
					          args: -D CHECK_USING_CLANG=ON
 | 
				
			||||||
 | 
					          test-args: -R test
 | 
				
			||||||
      - name: Run the build results
 | 
					 | 
				
			||||||
        run: build/test_c && build/test_cpp
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  specified-generator-usage:
 | 
					  specified-generator-usage:
 | 
				
			||||||
    runs-on: ${{ matrix.os }}-latest
 | 
					    runs-on: ${{ matrix.os }}-latest
 | 
				
			||||||
@ -91,7 +92,6 @@ jobs:
 | 
				
			|||||||
        uses: ./
 | 
					        uses: ./
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          source-dir: test
 | 
					          source-dir: test
 | 
				
			||||||
 | 
					          run-test: true
 | 
				
			||||||
          generator: Ninja
 | 
					          generator: Ninja
 | 
				
			||||||
 | 
					          test-args: -R hello_world
 | 
				
			||||||
      - name: Run the build result
 | 
					 | 
				
			||||||
        run: build/hello_world
 | 
					 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										40
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										40
									
								
								README.md
									
									
									
									
									
								
							@ -4,7 +4,18 @@
 | 
				
			|||||||
[](./LICENSE)
 | 
					[](./LICENSE)
 | 
				
			||||||
[](https://github.com/threeal/cmake-action/actions/workflows/test.yml)
 | 
					[](https://github.com/threeal/cmake-action/actions/workflows/test.yml)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Configure and build a [CMake](https://cmake.org/) project on [GitHub Actions](https://github.com/features/actions).
 | 
					Configure, build, and test a [CMake](https://cmake.org/) project on [GitHub Actions](https://github.com/features/actions).
 | 
				
			||||||
 | 
					Use this action to simplify the workflow run of your CMake project.
 | 
				
			||||||
 | 
					This action will configure a build environment for your project using the `cmake` command,
 | 
				
			||||||
 | 
					  then it will build your project by running a `cmake --build` command,
 | 
				
			||||||
 | 
					  and last it could test your project using the `ctest` command.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Features
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- Configure and build a project using the [cmake](https://cmake.org/cmake/help/latest/manual/cmake.1.html) command.
 | 
				
			||||||
 | 
					- Optionally test a project using the [ctest](https://cmake.org/cmake/help/latest/manual/ctest.1.html) command.
 | 
				
			||||||
 | 
					- Auto-detect and install required dependencies.
 | 
				
			||||||
 | 
					- Specify multiple CMake options directly from the Action inputs.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Usage
 | 
					## Usage
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -15,14 +26,16 @@ For more information, see [action.yml](./action.yml) and [GitHub Actions guide](
 | 
				
			|||||||
| Name | Value Type | Description |
 | 
					| Name | Value Type | Description |
 | 
				
			||||||
| --- | --- | --- |
 | 
					| --- | --- | --- |
 | 
				
			||||||
| `source-dir` | Path | Source directory of the CMake project. Defaults to current directory. |
 | 
					| `source-dir` | Path | Source directory of the CMake project. Defaults to current directory. |
 | 
				
			||||||
| `build-dir` | Path | Build directory of the CMake project. Defaults to `build` directory in current directory. |
 | 
					| `build-dir` | Path | Build directory of the CMake project. Defaults to `build` directory inside the source directory. |
 | 
				
			||||||
| `targets` | Multiple strings | List of build targets. |
 | 
					| `targets` | Multiple strings | List of build targets. |
 | 
				
			||||||
 | 
					| `run-test` | `true` or `false` | If enabled, run testing using [CTest](https://cmake.org/cmake/help/latest/manual/ctest.1.html). Defaults to `false`. |
 | 
				
			||||||
| `generator` | String | Build system generator of the CMake project. |
 | 
					| `generator` | String | Build system generator of the CMake project. |
 | 
				
			||||||
| `c-compiler` | String | Preferred executable for compiling C language files. |
 | 
					| `c-compiler` | String | Preferred executable for compiling C language files. |
 | 
				
			||||||
| `cxx-compiler` | String | Preferred executable for compiling C++ language files. |
 | 
					| `cxx-compiler` | String | Preferred executable for compiling C++ language files. |
 | 
				
			||||||
| `c-flags` | Multiple strings | Additional flags passed when compiling C language files. |
 | 
					| `c-flags` | Multiple strings | Additional flags passed when compiling C language files. |
 | 
				
			||||||
| `cxx-flags` | Multiple strings | Additional flags passed when compiling C++ language files. |
 | 
					| `cxx-flags` | Multiple strings | Additional flags passed when compiling C++ language files. |
 | 
				
			||||||
| `args` | Multiple strings | Additional arguments passed during the CMake configuration. |
 | 
					| `args` | Multiple strings | Additional arguments passed during the CMake configuration. |
 | 
				
			||||||
 | 
					| `test-args` | Multiple strings | Additional arguments passed during the CTest run. |
 | 
				
			||||||
 | 
					
 | 
				
			||||||
> Note: Multiple strings mean that the input could be specified with more than one value. Separate each value with a space or a new line.
 | 
					> Note: Multiple strings mean that the input could be specified with more than one value. Separate each value with a space or a new line.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -45,7 +58,7 @@ jobs:
 | 
				
			|||||||
        uses: threeal/cmake-action@latest
 | 
					        uses: threeal/cmake-action@latest
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
> Note: You can replace `@latest` with any version you like.
 | 
					> Note: You can replace `@latest` with any version you like. See [this](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsuses).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### Specify the Source and the Build Directories
 | 
					#### Specify the Source and the Build Directories
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -54,21 +67,26 @@ jobs:
 | 
				
			|||||||
  uses: threeal/cmake-action@latest
 | 
					  uses: threeal/cmake-action@latest
 | 
				
			||||||
  with:
 | 
					  with:
 | 
				
			||||||
    source-dir: submodules
 | 
					    source-dir: submodules
 | 
				
			||||||
    build-dir: submodules/build
 | 
					    build-dir: submodules/out
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### Specify the Build Targets and Additional Options
 | 
					#### Specify the Build Targets
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```yaml
 | 
					```yaml
 | 
				
			||||||
- name: Configure and build this project
 | 
					- name: Configure and build this project
 | 
				
			||||||
  uses: threeal/cmake-action@latest
 | 
					  uses: threeal/cmake-action@latest
 | 
				
			||||||
  with:
 | 
					  with:
 | 
				
			||||||
    targets: hello_world_test fibonacci_test
 | 
					    targets: hello_mars hello_sun
 | 
				
			||||||
    c-flags: -Werror
 | 
					```
 | 
				
			||||||
    cxx-flags: -Werror
 | 
					
 | 
				
			||||||
    args: |
 | 
					#### Run Unit Tests After Build
 | 
				
			||||||
      -DCMAKE_BUILD_TYPE=Debug
 | 
					
 | 
				
			||||||
      -DBUILD_TESTING=ON
 | 
					```yaml
 | 
				
			||||||
 | 
					- name: Configure, build, and test this project
 | 
				
			||||||
 | 
					  uses: threeal/cmake-action@latest
 | 
				
			||||||
 | 
					  with:
 | 
				
			||||||
 | 
					    args: -DBUILD_TESTING=ON
 | 
				
			||||||
 | 
					    run-test: true
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### Using Ninja as the Generator and Clang as the Compiler
 | 
					#### Using Ninja as the Generator and Clang as the Compiler
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										52
									
								
								action.yml
									
									
									
									
									
								
							
							
						
						
									
										52
									
								
								action.yml
									
									
									
									
									
								
							@ -1,5 +1,5 @@
 | 
				
			|||||||
name: CMake Action
 | 
					name: CMake Action
 | 
				
			||||||
description: Configure and build a CMake project
 | 
					description: Configure, build, and test a CMake project
 | 
				
			||||||
author: Alfi Maulana
 | 
					author: Alfi Maulana
 | 
				
			||||||
branding:
 | 
					branding:
 | 
				
			||||||
  color: gray-dark
 | 
					  color: gray-dark
 | 
				
			||||||
@ -8,14 +8,16 @@ inputs:
 | 
				
			|||||||
  source-dir:
 | 
					  source-dir:
 | 
				
			||||||
    description: Source directory of the CMake project
 | 
					    description: Source directory of the CMake project
 | 
				
			||||||
    required: false
 | 
					    required: false
 | 
				
			||||||
    default: .
 | 
					 | 
				
			||||||
  build-dir:
 | 
					  build-dir:
 | 
				
			||||||
    description: Build directory of the CMake project
 | 
					    description: Build directory of the CMake project
 | 
				
			||||||
    required: false
 | 
					    required: false
 | 
				
			||||||
    default: build
 | 
					 | 
				
			||||||
  targets:
 | 
					  targets:
 | 
				
			||||||
    description: List of build targets
 | 
					    description: List of build targets
 | 
				
			||||||
    required: false
 | 
					    required: false
 | 
				
			||||||
 | 
					  run-test:
 | 
				
			||||||
 | 
					    description: If enabled, run testing using CTest (true/false)
 | 
				
			||||||
 | 
					    required: false
 | 
				
			||||||
 | 
					    default: false
 | 
				
			||||||
  generator:
 | 
					  generator:
 | 
				
			||||||
    description: Build system generator of the CMake project
 | 
					    description: Build system generator of the CMake project
 | 
				
			||||||
    required: false
 | 
					    required: false
 | 
				
			||||||
@ -34,6 +36,9 @@ inputs:
 | 
				
			|||||||
  args:
 | 
					  args:
 | 
				
			||||||
    description: Additional arguments passed during the CMake configuration
 | 
					    description: Additional arguments passed during the CMake configuration
 | 
				
			||||||
    required: false
 | 
					    required: false
 | 
				
			||||||
 | 
					  test-args:
 | 
				
			||||||
 | 
					    description: Additional arguments passed during the CTest run
 | 
				
			||||||
 | 
					    required: false
 | 
				
			||||||
runs:
 | 
					runs:
 | 
				
			||||||
  using: composite
 | 
					  using: composite
 | 
				
			||||||
  steps:
 | 
					  steps:
 | 
				
			||||||
@ -41,31 +46,49 @@ runs:
 | 
				
			|||||||
      id: process_inputs
 | 
					      id: process_inputs
 | 
				
			||||||
      shell: bash
 | 
					      shell: bash
 | 
				
			||||||
      run: |
 | 
					      run: |
 | 
				
			||||||
        ARGS="${{ inputs.source-dir }} -B ${{ inputs.build-dir }}"
 | 
					        SOURCE_DIR="."
 | 
				
			||||||
        BUILD_ARGS="--build ${{ inputs.build-dir }}"
 | 
					        if [ -n '${{ inputs.source-dir }}' ]; then
 | 
				
			||||||
 | 
					          SOURCE_DIR="${{ inputs.source-dir }}"
 | 
				
			||||||
 | 
					        fi
 | 
				
			||||||
 | 
					        BUILD_DIR="build"
 | 
				
			||||||
 | 
					        if [ -n '${{ inputs.build-dir }}' ]; then
 | 
				
			||||||
 | 
					          BUILD_DIR="${{ inputs.build-dir }}"
 | 
				
			||||||
 | 
					        elif [ -n "${{ inputs.source-dir }}" ]; then
 | 
				
			||||||
 | 
					          BUILD_DIR="${{ inputs.source-dir }}/build"
 | 
				
			||||||
 | 
					        fi
 | 
				
			||||||
 | 
					        ARGS="'$SOURCE_DIR' -B '$BUILD_DIR'"
 | 
				
			||||||
 | 
					        BUILD_ARGS="--build '$BUILD_DIR'"
 | 
				
			||||||
 | 
					        TEST_ARGS=""
 | 
				
			||||||
        if [ -n '${{ inputs.targets }}' ]; then
 | 
					        if [ -n '${{ inputs.targets }}' ]; then
 | 
				
			||||||
          BUILD_ARGS="$BUILD_ARGS --target ${{ inputs.targets }}"
 | 
					          BUILD_ARGS="$BUILD_ARGS --target ${{ inputs.targets }}"
 | 
				
			||||||
        fi
 | 
					        fi
 | 
				
			||||||
 | 
					        if [ '${{ inputs.run-test }}' == 'true' ]; then
 | 
				
			||||||
 | 
					          TEST_ARGS="--test-dir '$BUILD_DIR' --output-on-failure --no-tests=error"
 | 
				
			||||||
 | 
					        fi
 | 
				
			||||||
        if [ -n '${{ inputs.generator }}' ]; then
 | 
					        if [ -n '${{ inputs.generator }}' ]; then
 | 
				
			||||||
          ARGS="$ARGS -G ${{ inputs.generator }}"
 | 
					          ARGS="$ARGS -G '${{ inputs.generator }}'"
 | 
				
			||||||
        fi
 | 
					        fi
 | 
				
			||||||
        if [ -n '${{ inputs.c-compiler }}' ]; then
 | 
					        if [ -n '${{ inputs.c-compiler }}' ]; then
 | 
				
			||||||
          ARGS="$ARGS -D CMAKE_C_COMPILER=${{ inputs.c-compiler }}"
 | 
					          ARGS="$ARGS -D CMAKE_C_COMPILER='${{ inputs.c-compiler }}'"
 | 
				
			||||||
        fi
 | 
					        fi
 | 
				
			||||||
        if [ -n '${{ inputs.cxx-compiler }}' ]; then
 | 
					        if [ -n '${{ inputs.cxx-compiler }}' ]; then
 | 
				
			||||||
          ARGS="$ARGS -D CMAKE_CXX_COMPILER=${{ inputs.cxx-compiler }}"
 | 
					          ARGS="$ARGS -D CMAKE_CXX_COMPILER='${{ inputs.cxx-compiler }}'"
 | 
				
			||||||
        fi
 | 
					        fi
 | 
				
			||||||
        if [ -n '${{ inputs.c-flags }}' ]; then
 | 
					        if [ -n '${{ inputs.c-flags }}' ]; then
 | 
				
			||||||
          ARGS="$ARGS -D CMAKE_C_FLAGS=${{ inputs.c-flags }}"
 | 
					          ARGS="$ARGS -D CMAKE_C_FLAGS='${{ inputs.c-flags }}'"
 | 
				
			||||||
        fi
 | 
					        fi
 | 
				
			||||||
        if [ -n '${{ inputs.cxx-flags }}' ]; then
 | 
					        if [ -n '${{ inputs.cxx-flags }}' ]; then
 | 
				
			||||||
          ARGS="$ARGS -D CMAKE_CXX_FLAGS=${{ inputs.cxx-flags }}"
 | 
					          ARGS="$ARGS -D CMAKE_CXX_FLAGS='${{ inputs.cxx-flags }}'"
 | 
				
			||||||
        fi
 | 
					        fi
 | 
				
			||||||
        if [ -n '${{ inputs.args }}' ]; then
 | 
					        if [ -n '${{ inputs.args }}' ]; then
 | 
				
			||||||
          ARGS="$ARGS ${{ inputs.args }}"
 | 
					          ARGS="$ARGS ${{ inputs.args }}"
 | 
				
			||||||
        fi
 | 
					        fi
 | 
				
			||||||
 | 
					        if [ -n '${{ inputs.test-args }}' ]; then
 | 
				
			||||||
 | 
					          TEST_ARGS="$TEST_ARGS ${{ inputs.test-args }}"
 | 
				
			||||||
 | 
					        fi
 | 
				
			||||||
        echo "cmake_args=${ARGS//[$'\t\r\n']}" >> $GITHUB_OUTPUT
 | 
					        echo "cmake_args=${ARGS//[$'\t\r\n']}" >> $GITHUB_OUTPUT
 | 
				
			||||||
        echo "cmake_build_args=${BUILD_ARGS//[$'\t\r\n']}" >> $GITHUB_OUTPUT
 | 
					        echo "cmake_build_args=${BUILD_ARGS//[$'\t\r\n']}" >> $GITHUB_OUTPUT
 | 
				
			||||||
 | 
					        echo "cmake_test_args=${TEST_ARGS//[$'\t\r\n']}" >> $GITHUB_OUTPUT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    - name: Install Ninja
 | 
					    - name: Install Ninja
 | 
				
			||||||
      if: ${{ inputs.generator == 'Ninja' }}
 | 
					      if: ${{ inputs.generator == 'Ninja' }}
 | 
				
			||||||
@ -78,9 +101,14 @@ runs:
 | 
				
			|||||||
        esac
 | 
					        esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    - name: Configure the CMake project
 | 
					    - name: Configure the CMake project
 | 
				
			||||||
      shell: bash
 | 
					      shell: ${{ runner.os == 'Windows' && 'pwsh' || 'bash' }}
 | 
				
			||||||
      run: cmake ${{ steps.process_inputs.outputs.cmake_args }}
 | 
					      run: cmake ${{ steps.process_inputs.outputs.cmake_args }}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    - name: Build targets
 | 
					    - name: Build targets
 | 
				
			||||||
      shell: bash
 | 
					      shell: ${{ runner.os == 'Windows' && 'pwsh' || 'bash' }}
 | 
				
			||||||
      run: cmake ${{ steps.process_inputs.outputs.cmake_build_args }}
 | 
					      run: cmake ${{ steps.process_inputs.outputs.cmake_build_args }}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - name: Run tests
 | 
				
			||||||
 | 
					      if: steps.process_inputs.outputs.cmake_test_args != ''
 | 
				
			||||||
 | 
					      shell: ${{ runner.os == 'Windows' && 'pwsh' || 'bash' }}
 | 
				
			||||||
 | 
					      run: ctest ${{ steps.process_inputs.outputs.cmake_test_args }}
 | 
				
			||||||
 | 
				
			|||||||
@ -5,11 +5,18 @@ option(CHECK_USING_CLANG "check if target is compiled using Clang" OFF)
 | 
				
			|||||||
option(CHECK_SURPASS_WARNING "check if target could surpass a compiler warning" OFF)
 | 
					option(CHECK_SURPASS_WARNING "check if target could surpass a compiler warning" OFF)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if(CHECK_SURPASS_WARNING)
 | 
					if(CHECK_SURPASS_WARNING)
 | 
				
			||||||
  set(CMAKE_C_FLAGS "-Werror -Wunused-variable ${CMAKE_C_FLAGS}")
 | 
					  if(MSVC)
 | 
				
			||||||
  set(CMAKE_CXX_FLAGS "-Werror -Wunused-variable ${CMAKE_CXX_FLAGS}")
 | 
					    set(CMAKE_C_FLAGS "/WX /W4 ${CMAKE_C_FLAGS}")
 | 
				
			||||||
 | 
					    set(CMAKE_CXX_FLAGS "/WX /W4 ${CMAKE_CXX_FLAGS}")
 | 
				
			||||||
 | 
					  else()
 | 
				
			||||||
 | 
					    set(CMAKE_C_FLAGS "-Werror -Wunused-variable ${CMAKE_C_FLAGS}")
 | 
				
			||||||
 | 
					    set(CMAKE_CXX_FLAGS "-Werror -Wunused-variable ${CMAKE_CXX_FLAGS}")
 | 
				
			||||||
 | 
					  endif()
 | 
				
			||||||
endif()
 | 
					endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					enable_testing()
 | 
				
			||||||
add_executable(hello_world hello_world.cpp)
 | 
					add_executable(hello_world hello_world.cpp)
 | 
				
			||||||
 | 
					add_test(NAME hello_world COMMAND $<TARGET_FILE:hello_world>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
list(APPEND LANGS c cpp)
 | 
					list(APPEND LANGS c cpp)
 | 
				
			||||||
foreach(LANG ${LANGS})
 | 
					foreach(LANG ${LANGS})
 | 
				
			||||||
@ -21,4 +28,5 @@ foreach(LANG ${LANGS})
 | 
				
			|||||||
    $<$<BOOL:${CHECK_USING_CLANG}>:CHECK_USING_CLANG>
 | 
					    $<$<BOOL:${CHECK_USING_CLANG}>:CHECK_USING_CLANG>
 | 
				
			||||||
    $<$<BOOL:${CHECK_SURPASS_WARNING}>:CHECK_SURPASS_WARNING>
 | 
					    $<$<BOOL:${CHECK_SURPASS_WARNING}>:CHECK_SURPASS_WARNING>
 | 
				
			||||||
  )
 | 
					  )
 | 
				
			||||||
 | 
					  add_test(NAME test_${LANG} COMMAND $<TARGET_FILE:test_${LANG}>)
 | 
				
			||||||
endforeach()
 | 
					endforeach()
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user