From 481f859c047800f0db4e853e0d30df5d9eea9ea8 Mon Sep 17 00:00:00 2001 From: Nikita Timakin Date: Fri, 12 Mar 2021 16:38:06 +0300 Subject: [PATCH] [rls] Additional Flags for Linker in CMake (#1495) * Additional flags for linker in CMake * fix * fix --- examples/daal/cpp/CMakeLists.txt | 6 +++++- examples/daal/cpp_sycl/CMakeLists.txt | 6 +++++- examples/oneapi/cpp/CMakeLists.txt | 6 +++++- examples/oneapi/dpc/CMakeLists.txt | 6 +++++- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/examples/daal/cpp/CMakeLists.txt b/examples/daal/cpp/CMakeLists.txt index 8a3ce07cb11..a197b1f2522 100644 --- a/examples/daal/cpp/CMakeLists.txt +++ b/examples/daal/cpp/CMakeLists.txt @@ -27,7 +27,11 @@ function (add_examples examples) foreach(example ${examples}) add_executable(${example} "${example}.cpp") target_include_directories(${example} PRIVATE ${oneDAL_INCLUDE_DIRS}) - target_link_libraries(${example} PRIVATE ${oneDAL_IMPORTED_TARGETS}) + if (UNIX) + target_link_libraries(${example} PRIVATE -Wl,--start-group ${oneDAL_IMPORTED_TARGETS} -Wl,--end-group) + else() + target_link_libraries(${example} PRIVATE ${oneDAL_IMPORTED_TARGETS}) + endif() set_target_properties(${example} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/_cmake_results/intel_intel64_${THREADING_TYPE}_${LINK_TYPE}") endforeach() endfunction() diff --git a/examples/daal/cpp_sycl/CMakeLists.txt b/examples/daal/cpp_sycl/CMakeLists.txt index f93d6c3039c..991b4f2b1f8 100644 --- a/examples/daal/cpp_sycl/CMakeLists.txt +++ b/examples/daal/cpp_sycl/CMakeLists.txt @@ -31,7 +31,11 @@ function (add_examples examples) foreach(example ${examples}) add_executable(${example} "${example}.cpp") target_include_directories(${example} PRIVATE ${oneDAL_INCLUDE_DIRS}) - target_link_libraries(${example} PRIVATE ${oneDAL_IMPORTED_TARGETS}) + if (UNIX) + target_link_libraries(${example} PRIVATE -Wl,--start-group ${oneDAL_IMPORTED_TARGETS} -Wl,--end-group) + else() + target_link_libraries(${example} PRIVATE ${oneDAL_IMPORTED_TARGETS}) + endif() set_target_properties(${example} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/_cmake_results/intel_intel64_${THREADING_TYPE}_${LINK_TYPE}") endforeach() endfunction() diff --git a/examples/oneapi/cpp/CMakeLists.txt b/examples/oneapi/cpp/CMakeLists.txt index 04c7ac7be09..936750269f1 100644 --- a/examples/oneapi/cpp/CMakeLists.txt +++ b/examples/oneapi/cpp/CMakeLists.txt @@ -27,7 +27,11 @@ function (add_examples examples) foreach(example ${examples}) add_executable(${example} "${example}.cpp") target_include_directories(${example} PRIVATE ${oneDAL_INCLUDE_DIRS}) - target_link_libraries(${example} PRIVATE ${oneDAL_IMPORTED_TARGETS}) + if (UNIX) + target_link_libraries(${example} PRIVATE -Wl,--start-group ${oneDAL_IMPORTED_TARGETS} -Wl,--end-group) + else() + target_link_libraries(${example} PRIVATE ${oneDAL_IMPORTED_TARGETS}) + endif() set_target_properties(${example} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/_cmake_results/intel_intel64_${THREADING_TYPE}_${LINK_TYPE}") endforeach() endfunction() diff --git a/examples/oneapi/dpc/CMakeLists.txt b/examples/oneapi/dpc/CMakeLists.txt index f2c41301754..137bbdfff57 100644 --- a/examples/oneapi/dpc/CMakeLists.txt +++ b/examples/oneapi/dpc/CMakeLists.txt @@ -31,7 +31,11 @@ function (add_examples examples) foreach(example ${examples}) add_executable(${example} "${example}.cpp") target_include_directories(${example} PRIVATE ${oneDAL_INCLUDE_DIRS}) - target_link_libraries(${example} PRIVATE ${oneDAL_IMPORTED_TARGETS}) + if (UNIX) + target_link_libraries(${example} PRIVATE -Wl,--start-group ${oneDAL_IMPORTED_TARGETS} -Wl,--end-group) + else() + target_link_libraries(${example} PRIVATE ${oneDAL_IMPORTED_TARGETS}) + endif() set_target_properties(${example} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/_cmake_results/intel_intel64_${THREADING_TYPE}_${LINK_TYPE}") endforeach() endfunction()