build: adopt xo-cmake macros as dependency

This commit is contained in:
Roland Conybeare 2023-09-27 09:23:55 -04:00
commit 5f025d8fc8
3 changed files with 26 additions and 6 deletions

View file

@ -22,18 +22,36 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Configure CMake
# ----------------------------------------------------------------
- name: Clone xo-cmake
uses: actions/checkout@v3
with:
repository: Rconybea/xo-cmake
path: repo/xo-cmake
- name: Configure xo-cmake
run: cmake -B ${{github.workspace}}/build_xo-cmake -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local repo/xo-cmake
- name: Build xo-cmake (trivial)
run: cmake --build ${{github.workspace}}/build_xo-cmake --config ${{env.BUILD_TYPE}}
- name: Install xo-cmake
run: cmake --install ${{github.workspace}}/build_xo-cmake
# ----------------------------------------------------------------
- name: Configure self (subsys)
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
run: cmake -B ${{github.workspace}}/build -DCMAKE_MODULE_PATH=${{github.workspace}}/local/share/cmake -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build
- name: Build self (subsys)
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Test
- name: Test self (subsys)
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}}

View file

@ -3,6 +3,7 @@ cmake_minimum_required(VERSION 3.10)
project(subsys VERSION 0.1)
enable_language(CXX)
include (xo_macros/xo_cxx)
include(cmake/cxx.cmake)
include(cmake/code-coverage.cmake)

View file

@ -30,7 +30,8 @@ subsys
$ cd subsys
$ mkdir build
$ cd build
$ cmake -DCMAKE_PREFIX_PATH=${INSTALL_PREFIX} -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} ..
$ INSTALL_PREFIX=/usr/local # or wherever you prefer
$ cmake -DCMAKE_MODULE_PATH=${INSTALL_PREFIX}/share/cmake -DCMAKE_PREFIX_PATH=${INSTALL_PREFIX} -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} ..
$ make
$ make install
```