diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index 8cb80aa..d8186f6 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -1,11 +1,14 @@ +--- name: Install on: push: branches: + - master - develop pull_request: branches: + - master - develop env: @@ -26,12 +29,12 @@ jobs: - name: build and install library run: | - cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release + cmake -S . -B build -DCMAKE_BUILD_TYPE=Release sudo cmake --build build --target install rm -rf build - name: configure - run: cmake -Stest -Bbuild -DTEST_INSTALLED_VERSION=1 + run: cmake -S test -B build -DTEST_INSTALLED_VERSION=1 - name: build run: cmake --build build --config Debug -j4 diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index cba48ae..bbe6b24 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -1,11 +1,14 @@ +--- name: MacOS on: push: branches: + - master - develop pull_request: branches: + - master - develop env: @@ -25,7 +28,7 @@ jobs: key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }} - name: configure - run: cmake -Stest -Bbuild -DCMAKE_BUILD_TYPE=Debug + run: cmake -S test -B build -DCMAKE_BUILD_TYPE=Debug - name: build run: cmake --build build -j4 diff --git a/.github/workflows/standalone.yml b/.github/workflows/standalone.yml index bfb9c18..988163d 100644 --- a/.github/workflows/standalone.yml +++ b/.github/workflows/standalone.yml @@ -1,3 +1,4 @@ +--- name: Standalone on: @@ -24,10 +25,10 @@ jobs: key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }} - name: configure - run: cmake -Sstandalone -Bbuild -DCMAKE_BUILD_TYPE=Debug -DCMAKE_BUILD_TYPE=Debug + run: cmake -S standalone -B build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_BUILD_TYPE=Debug - name: build run: cmake --build build -j4 - name: run - run: ./build/Greeter + run: ./build/bin/Greeter diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index d3ed946..9fabf78 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -1,11 +1,14 @@ +--- name: Style on: push: branches: + - master - develop pull_request: branches: + - master - develop env: @@ -29,7 +32,7 @@ jobs: pip3 install cmake_format==0.6.11 pyyaml - name: configure - run: cmake -Stest -Bbuild + run: cmake -S test -B build - name: check style run: cmake --build build --target check-format diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index dfc2ec5..ad04e6a 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -1,11 +1,14 @@ +--- name: Ubuntu on: push: branches: + - master - develop pull_request: branches: + - master - develop env: @@ -26,7 +29,7 @@ jobs: key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }} - name: configure - run: cmake -Stest -Bbuild -DENABLE_TEST_COVERAGE=1 -DCMAKE_BUILD_TYPE=Debug + run: cmake -S test -B build -DENABLE_TEST_COVERAGE=1 -DCMAKE_BUILD_TYPE=Debug - name: build run: cmake --build build -j4 diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 1f5f100..2459373 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -4,9 +4,11 @@ name: Windows on: push: branches: + - master - develop pull_request: branches: + - master - develop env: @@ -26,7 +28,7 @@ jobs: key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }} - name: configure - run: cmake -Stest -Bbuild # XXX -G "Visual Studio 16 2019" -T ClangCL + run: cmake -S test -B build # XXX -G "Visual Studio 16 2019" -T ClangCL - name: build run: cmake --build build --config Debug -j4 @@ -34,8 +36,5 @@ jobs: - name: test run: | cd build - tree bin\Debug - tree x64\Debug - dir Debug - Debug/GreeterTests.exe -s + tree ctest --build-config Debug --verbose diff --git a/CMakeLists.txt b/CMakeLists.txt index 45135f6..6de268a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,9 +20,10 @@ endif() # ---- Project settings ---- -# XXX if(NOT MSVC) option(BUILD_SHARED_LIBS "Create shared libraries if ON" YES) -# XXX endif() +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) if(NOT DEFINED CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 17) diff --git a/GNUmakefile b/GNUmakefile index 77888a8..3b6fca9 100755 --- a/GNUmakefile +++ b/GNUmakefile @@ -6,7 +6,7 @@ ROOT?=${CURDIR}/stagedir GENERATOR?=Ninja #XXX export CXX=clang++ -export CPM_USE_LOCAL_PACKAGES=1 +export CPM_USE_LOCAL_PACKAGES=0 export CPM_SOURCE_CACHE=${HOME}/.cache/CPM .PHONY: update format all test standalone doc check clean distclean lock diff --git a/cmake/tools.cmake b/cmake/tools.cmake index 3ed235e..bf2216f 100644 --- a/cmake/tools.cmake +++ b/cmake/tools.cmake @@ -9,6 +9,10 @@ endif() include(${CMAKE_CURRENT_LIST_DIR}/CPM.cmake) CPMUsePackageLock(package-lock.cmake) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) + if(NOT DEFINED CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index de24d8e..f3810b0 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -61,7 +61,7 @@ endif() enable_testing() -add_test(greeterTests GreeterTests) +add_test(NAME greeterTests COMMAND GreeterTests) # ---- code coverage ----