mirror of https://github.com/AlexeyAB/darknet.git
[pthread cmake module] fix shared target handling
This commit is contained in:
parent
9baf9861d7
commit
4d135b5992
|
@ -39,6 +39,12 @@ endif()
|
||||||
find_package_handle_standard_args(PThreads_windows DEFAULT_MSG PThreads_windows_LIBRARY PThreads_windows_INCLUDE_DIR)
|
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)
|
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:
|
# Register imported libraries:
|
||||||
# 1. If we can find a Windows .dll file (or if we can find both Debug and
|
# 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
|
# 2. However, for most systems, we will only register the import location and
|
||||||
# include directory.
|
# 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( PThreads_windows_FOUND AND NOT TARGET PThreads_windows::PThreads_windows )
|
||||||
if( EXISTS "${PThreads_windows_LIBRARY_RELEASE_DLL}" )
|
if( EXISTS "${PThreads_windows_LIBRARY_RELEASE_DLL}" )
|
||||||
add_library( PThreads_windows::PThreads_windows SHARED IMPORTED )
|
add_library( PThreads_windows::PThreads_windows SHARED IMPORTED )
|
||||||
|
|
Loading…
Reference in New Issue