From 4decd2df5ab7ccdf1a7b878f77cd0d0e44ff8884 Mon Sep 17 00:00:00 2001 From: Dmitry Babokin Date: Thu, 29 Aug 2024 13:07:44 -0700 Subject: [PATCH] Handle OpenMP libraries in portable way (issue #959) --- cmake/modules/xsmm-dnn.cmake | 2 +- tools/tpp-run/CMakeLists.txt | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/cmake/modules/xsmm-dnn.cmake b/cmake/modules/xsmm-dnn.cmake index c72c8d512..b51a67ed5 100644 --- a/cmake/modules/xsmm-dnn.cmake +++ b/cmake/modules/xsmm-dnn.cmake @@ -46,6 +46,6 @@ target_include_directories(xsmm_dnn_mlp PRIVATE ${XSMM_DNN_INCLUDE_DIRS}) target_link_libraries(xsmm_dnn_mlp PRIVATE xsmm) if (OPENMP_FOUND) target_compile_options(xsmm_dnn_mlp PRIVATE ${OpenMP_C_FLAGS}) - target_link_libraries(xsmm_dnn_mlp PRIVATE omp) + target_link_libraries(xsmm_dnn_mlp PRIVATE OpenMP::OpenMP_C) endif() install(TARGETS xsmm_dnn_mlp RUNTIME DESTINATION bin) diff --git a/tools/tpp-run/CMakeLists.txt b/tools/tpp-run/CMakeLists.txt index 92470d61f..f1d639a21 100644 --- a/tools/tpp-run/CMakeLists.txt +++ b/tools/tpp-run/CMakeLists.txt @@ -9,10 +9,6 @@ if(USE_OneDNN) set(ONEDNN_LIBS_INCL "-ltpp_dnnl_runner_utils") endif() -if(USE_OpenMP) - set(OPENMP_LIBS_INCL "-lomp") -endif() - set(LIBS ${dialect_libs} ${conversion_libs} @@ -88,7 +84,7 @@ target_link_options(tpp-run PRIVATE -lmlir_runner_utils -lmlir_async_runtime ${TPP_GPU_LINK_FLAGS} - ${OPENMP_LIBS_INCL} + $<$:${OpenMP_C_LIBRARIES}> -Wl,--as-needed )