diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml new file mode 100644 index 0000000..b3f6f9c --- /dev/null +++ b/.github/workflows/install.yml @@ -0,0 +1,30 @@ +name: Install + +on: [push] + +env: + CTEST_OUTPUT_ON_FAILURE: 1 + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + + - name: install + run: | + cmake -H. -Bbuild + cmake --build build --target install + + - name: configure + run: cmake -Htest -Bbuild/test -DTEST_INSTALLED_VERSION=1 + + - name: build + run: cmake --build build/test --config Debug + + - name: test + run: | + cd build/test + ctest --build-config Debug diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 086e31b..6838995 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -7,6 +7,7 @@ project(GreeterTests # ---- Options ---- option(ENABLE_TEST_COVERAGE "Enable test coverage" OFF) +option(TEST_INSTALLED_VERSION "Test the version found by find_package" OFF) # ---- Dependencies ---- @@ -19,10 +20,14 @@ CPMAddPackage( GIT_TAG 2.3.2 ) -CPMAddPackage( - NAME Greeter - SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/.. -) +if (TEST_INSTALLED_VERSION) + find_package(Greeter) +else() + CPMAddPackage( + NAME Greeter + SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/.. + ) +endif() CPMAddPackage( NAME Format.cmake