From 9d372e8932b730f9cf8f9a0fd44e4d2afbab6a99 Mon Sep 17 00:00:00 2001 From: Lars Bilke <lars.bilke@ufz.de> Date: Tue, 20 Jul 2021 11:40:26 +0200 Subject: [PATCH] [cmake] Use cmake_dependent_option(). --- CMakeLists.txt | 9 +++------ scripts/cmake/CMakeSetup.cmake | 1 + 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 665d6980904..746f6fb43ad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,12 +43,9 @@ option(OGS_USE_PYTHON "Interface with Python" ON) option(OGS_USE_POETRY "Enables automatic Python virtual environment handling with poetry." ON ) -if(WIN32) - option(OGS_BUILD_SWMM "Should the SWMM interface be built?" ON) -endif() -if(NOT WIN32 AND OGS_BUILD_SWMM) - message(FATAL_ERROR "OGS_BUILD_SWMM requires Windows!") -endif() +cmake_dependent_option( + OGS_BUILD_SWMM "Should the SWMM interface be built?" ON "WIN32" OFF +) if(OGS_USE_PETSC) set(OGS_USE_MPI ON CACHE BOOL "Use MPI" FORCE) diff --git a/scripts/cmake/CMakeSetup.cmake b/scripts/cmake/CMakeSetup.cmake index 763b6f4bc0d..5bea088560a 100644 --- a/scripts/cmake/CMakeSetup.cmake +++ b/scripts/cmake/CMakeSetup.cmake @@ -37,6 +37,7 @@ include(GNUInstallDirs) include(ProcessorCount) ProcessorCount(NUM_PROCESSORS) set(NUM_PROCESSORS ${NUM_PROCESSORS} CACHE STRING "Processor count") +include(CMakeDependentOption) # Check if this project is included in another if(NOT PROJECT_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) -- GitLab