From b77a64c49aa65a5b4c797c322984629e126233b6 Mon Sep 17 00:00:00 2001 From: Michael Hirsch Date: Mon, 11 Oct 2021 00:45:48 -0400 Subject: [PATCH] cmake build type --- .github/workflows/ci_cmake.yml | 9 +++++---- CMakeLists.txt | 12 ++++-------- README.md | 6 +++--- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci_cmake.yml b/.github/workflows/ci_cmake.yml index 66a1e24..08d3020 100644 --- a/.github/workflows/ci_cmake.yml +++ b/.github/workflows/ci_cmake.yml @@ -1,5 +1,8 @@ name: ci_cmake +env: + CMAKE_BUILD_TYPE: Release + on: push: paths: @@ -16,8 +19,7 @@ jobs: - run: cmake -B build -G "MinGW Makefiles" - run: cmake --build build --parallel - - run: ctest -V - working-directory: build + - run: ctest --test-dir build linux: runs-on: ubuntu-latest @@ -27,5 +29,4 @@ jobs: - run: cmake -B build - run: cmake --build build --parallel - - run: ctest -V - working-directory: build + - run: ctest --test-dir build diff --git a/CMakeLists.txt b/CMakeLists.txt index a7ceac6..469db42 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,7 @@ -cmake_minimum_required (VERSION 3.7) +cmake_minimum_required (VERSION 3.14...3.21) -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE "Release" CACHE STRING "default build type") -endif() - -project(snpcal LANGUAGES Fortran) +project(snpcal +LANGUAGES Fortran) include(CTest) @@ -25,8 +22,7 @@ configure_file(snpcal.dat ${CMAKE_CURRENT_BINARY_DIR} COPYONLY) #--- install -install(TARGETS snpcal - RUNTIME DESTINATION bin) +install(TARGETS snpcal TYPE RUNTIME) install(FILES ${snpcal_SOURCE_DIR}/snpcal.dat DESTINATION bin diff --git a/README.md b/README.md index 15c89c0..81fb096 100644 --- a/README.md +++ b/README.md @@ -16,15 +16,15 @@ Modified: Assuming any modern Fortran compiler (tested with Gfortran, PGI, Flang and Intel `ifort`): ```sh -cmake .. +cmake -B build -cmake --build . +cmake --build build ``` test output with ```sh -ctest -V +ctest --test-dir build ``` ## Usage