diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6a0da47..71bc342 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,7 @@ env: HOMEBREW_NO_INSTALL_CLEANUP: 1 CTEST_NO_TESTS_ACTION: error CMAKE_BUILD_PARALLEL_LEVEL: 4 - CTEST_PARALLEL_LEVEL: 4 + CTEST_PARALLEL_LEVEL: 0 on: push: @@ -28,13 +28,14 @@ jobs: env: FC: gfortran-13 + CMAKE_INSTALL_PREFIX: ~/libs steps: - uses: actions/checkout@v4 - name: Configure - run: cmake --preset default -DBUILD_SHARED_LIBS:BOOL=${{ matrix.shared }} --install-prefix=${{ runner.temp }} + run: cmake --preset default -DBUILD_SHARED_LIBS:BOOL=${{ matrix.shared }} - name: Build run: cmake --build --preset default diff --git a/cmake/options.cmake b/cmake/options.cmake index ffc7f26..efd9bda 100644 --- a/cmake/options.cmake +++ b/cmake/options.cmake @@ -2,7 +2,14 @@ include(GNUInstallDirs) message(STATUS "${PROJECT_NAME} ${PROJECT_VERSION} CMake ${CMAKE_VERSION} Toolchain ${CMAKE_TOOLCHAIN_FILE}") -option(${PROJECT_NAME}_BUILD_TESTING "Build tests" ${PROJECT_IS_TOP_LEVEL}) +if(CMAKE_VERSION VERSION_LESS 3.21) + get_property(not_top DIRECTORY PROPERTY PARENT_DIRECTORY) + if(NOT not_top) + set(${PROJECT_NAME}_IS_TOP_LEVEL true) + endif() +endif() + +option(${PROJECT_NAME}_BUILD_TESTING "Build tests" ${${PROJECT_NAME}_IS_TOP_LEVEL}) # Necessary for shared library with Visual Studio / Windows oneAPI set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS true)