From 4f837b9f382814c883fa9c0fa9b9003f5db6e094 Mon Sep 17 00:00:00 2001 From: liaogang Date: Thu, 18 May 2017 09:38:12 +0800 Subject: [PATCH] add ${CMAKE_THREAD_LIBS_INIT} --- cmake/generic.cmake | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/cmake/generic.cmake b/cmake/generic.cmake index 90ec9532e..89bf1ef1e 100644 --- a/cmake/generic.cmake +++ b/cmake/generic.cmake @@ -58,7 +58,7 @@ function(cc_binary TARGET_NAME) cmake_parse_arguments(cc_binary "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) add_executable(${TARGET_NAME} ${cc_binary_SRCS}) add_dependencies(${TARGET_NAME} ${cc_binary_DEPS} ${external_project_dependencies}) - target_link_libraries(${TARGET_NAME} ${cc_binary_DEPS}) + target_link_libraries(${TARGET_NAME} ${cc_binary_DEPS} ${CMAKE_THREAD_LIBS_INIT}) endfunction(cc_binary) # The dependency to target tensor implies that if any of @@ -75,7 +75,11 @@ function(cc_test TARGET_NAME) cmake_parse_arguments(cc_test "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) add_executable(${TARGET_NAME} ${cc_test_SRCS}) add_dependencies(${TARGET_NAME} ${cc_test_DEPS} ${external_project_dependencies}) - target_link_libraries(${TARGET_NAME} ${cc_test_DEPS} ${GTEST_MAIN_LIBRARIES} ${GTEST_LIBRARIES}) + target_link_libraries(${TARGET_NAME} + ${cc_test_DEPS} + ${GTEST_MAIN_LIBRARIES} + ${GTEST_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT}) add_test(${TARGET_NAME} ${TARGET_NAME}) endfunction(cc_test) @@ -107,7 +111,7 @@ function(nv_binary TARGET_NAME) cmake_parse_arguments(nv_binary "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) cuda_add_executable(${TARGET_NAME} ${nv_binary_SRCS}) add_dependencies(${TARGET_NAME} ${nv_binary_DEPS} ${external_project_dependencies}) - target_link_libraries(${TARGET_NAME} ${nv_binary_DEPS}) + target_link_libraries(${TARGET_NAME} ${nv_binary_DEPS} ${CMAKE_THREAD_LIBS_INIT}) endfunction(nv_binary) # The dependency to target tensor implies that if any of @@ -124,7 +128,11 @@ function(nv_test TARGET_NAME) cmake_parse_arguments(nv_test "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) cuda_add_executable(${TARGET_NAME} ${nv_test_SRCS}) add_dependencies(${TARGET_NAME} ${nv_test_DEPS} ${external_project_dependencies}) - target_link_libraries(${TARGET_NAME} ${nv_test_DEPS} ${GTEST_MAIN_LIBRARIES} ${GTEST_LIBRARIES}) + target_link_libraries(${TARGET_NAME} + ${nv_test_DEPS} + ${GTEST_MAIN_LIBRARIES} + ${GTEST_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT}) add_test(${TARGET_NAME} ${TARGET_NAME}) endfunction(nv_test) -- GitLab