From 308dcdd52ce651cca594b5b245374b1f1b2798c2 Mon Sep 17 00:00:00 2001 From: Gavin Ridley Date: Tue, 5 Mar 2024 22:31:43 -0500 Subject: [PATCH] abort on cmake config if openmp requested but not found --- CMakeLists.txt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ec6ea61792a..1280daf2b96 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -193,12 +193,10 @@ endif() if(NOT MSVC) if(OPENMC_USE_OPENMP) - find_package(OpenMP) - if(OPENMP_FOUND) - # In CMake 3.9+, can use the OpenMP::OpenMP_CXX imported target - list(APPEND cxxflags ${OpenMP_CXX_FLAGS}) - list(APPEND ldflags ${OpenMP_CXX_FLAGS}) - endif() + find_package(OpenMP REQUIRED) + # In CMake 3.9+, can use the OpenMP::OpenMP_CXX imported target + list(APPEND cxxflags ${OpenMP_CXX_FLAGS}) + list(APPEND ldflags ${OpenMP_CXX_FLAGS}) endif() set(CMAKE_POSITION_INDEPENDENT_CODE ON)