diff --git a/CMakeLists.txt b/CMakeLists.txt index 665d6980904ebee797ce3bafcb6da9d9b19d2f2a..746f6fb43ad2befc4df8cc0723a17800242bb135 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 763b6f4bc0dcec982c889c9a225736ac2853ace4..5bea088560a764dbec14df183b01b1b7628d7b67 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)