From b369e7730b857f79b832f09526a03b2cdffb47d5 Mon Sep 17 00:00:00 2001 From: fwcd Date: Sun, 12 Nov 2023 16:53:39 +0000 Subject: [PATCH] FindSleef: Use OpenMP in static builds --- cmake/modules/FindSleef.cmake | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cmake/modules/FindSleef.cmake b/cmake/modules/FindSleef.cmake index 9f54fcad4057..8b412b06a502 100644 --- a/cmake/modules/FindSleef.cmake +++ b/cmake/modules/FindSleef.cmake @@ -43,6 +43,8 @@ The following cache variables may also be set: #]=======================================================================] +include(IsStaticLibrary) + find_package(PkgConfig QUIET) if(PkgConfig_FOUND) pkg_check_modules(PC_Sleef QUIET sleef) @@ -108,5 +110,15 @@ if(Sleef_FOUND) INTERFACE_COMPILE_OPTIONS "${PC_Sleef_CFLAGS_OTHER}" INTERFACE_INCLUDE_DIRECTORIES "${Sleef_INCLUDE_DIR}" ) + + is_static_library(Sleef_IS_STATIC Sleef::sleef) + if(Sleef_IS_STATIC) + find_package(OpenMP) + if(OpenMP_FOUND) + set_property(TARGET Sleef::sleef APPEND PROPERTY INTERFACE_COMPILE_OPTIONS + "${OpenMP_CXX_FLAGS}" + ) + endif() + endif() endif() endif()