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()