From 4d135b5992504115a5c7e1cea98da5d0ea0fccd3 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Thu, 1 Aug 2019 11:22:30 +0200 Subject: [PATCH] [pthread cmake module] fix shared target handling --- cmake/Modules/FindPThreads_windows.cmake | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cmake/Modules/FindPThreads_windows.cmake b/cmake/Modules/FindPThreads_windows.cmake index e1c4cfd2..02d8a72d 100644 --- a/cmake/Modules/FindPThreads_windows.cmake +++ b/cmake/Modules/FindPThreads_windows.cmake @@ -39,6 +39,12 @@ endif() find_package_handle_standard_args(PThreads_windows DEFAULT_MSG PThreads_windows_LIBRARY PThreads_windows_INCLUDE_DIR) mark_as_advanced(PThreads_windows_INCLUDE_DIR PThreads_windows_LIBRARY) +set(PThreads_windows_DLL_DIR ${PThreads_windows_INCLUDE_DIR}) +list(TRANSFORM PThreads_windows_DLL_DIR APPEND "/../bin") +message(STATUS "PThreads_windows_DLL_DIR: ${PThreads_windows_DLL_DIR}") + +find_file(PThreads_windows_LIBRARY_RELEASE_DLL NAMES pthreadVC2.dll PATHS ${PThreads_windows_DLL_DIR}) +find_file(PThreads_windows_LIBRARY_DEBUG_DLL NAMES pthreadVC2d.dll PATHS ${PThreads_windows_DLL_DIR}) # Register imported libraries: # 1. If we can find a Windows .dll file (or if we can find both Debug and @@ -46,12 +52,6 @@ mark_as_advanced(PThreads_windows_INCLUDE_DIR PThreads_windows_LIBRARY) # 2. However, for most systems, we will only register the import location and # include directory. -# Look for dlls, for Release and Debug libraries. -if(WIN32) - string( REPLACE ".lib" ".dll" PThreads_windows_LIBRARY_RELEASE_DLL "${PThreads_windows_LIBRARY_RELEASE}" ) - string( REPLACE ".lib" ".dll" PThreads_windows_LIBRARY_DEBUG_DLL "${PThreads_windows_LIBRARY_DEBUG}" ) -endif() - if( PThreads_windows_FOUND AND NOT TARGET PThreads_windows::PThreads_windows ) if( EXISTS "${PThreads_windows_LIBRARY_RELEASE_DLL}" ) add_library( PThreads_windows::PThreads_windows SHARED IMPORTED )