aboutsummaryrefslogtreecommitdiff
path: root/ports/pthreads
diff options
context:
space:
mode:
authorStefano Sinigardi <stesinigardi@hotmail.com>2019-05-16 22:49:25 +0200
committerCurtis J Bezault <curtbezault@gmail.com>2019-05-16 13:49:25 -0700
commitec46f021817f4bc3f3e9385e4d09b9db9cef2786 (patch)
tree9a49e7fa25237c449db97463e5a9a6d67ff69a66 /ports/pthreads
parent031e494970035f6c09725a6433eb2adefb09d683 (diff)
downloadvcpkg-ec46f021817f4bc3f3e9385e4d09b9db9cef2786.tar.gz
vcpkg-ec46f021817f4bc3f3e9385e4d09b9db9cef2786.zip
[pthread] update to v3 (#6473)
* [pthread] update to v3 * [flint, mosquitto, usbmuxd] bump CONTROL files and add final touches for PThreads4W v3 * [arb] add compatibility with PThreads4W
Diffstat (limited to 'ports/pthreads')
-rw-r--r--ports/pthreads/CMakeLists.txt216
-rw-r--r--ports/pthreads/CONTROL2
-rw-r--r--ports/pthreads/portfile.cmake106
-rw-r--r--ports/pthreads/vcpkg-cmake-wrapper.cmake218
4 files changed, 290 insertions, 252 deletions
diff --git a/ports/pthreads/CMakeLists.txt b/ports/pthreads/CMakeLists.txt
deleted file mode 100644
index 32f25e716..000000000
--- a/ports/pthreads/CMakeLists.txt
+++ /dev/null
@@ -1,216 +0,0 @@
-cmake_minimum_required(VERSION 3.9.0)
-
-project(pthreads)
-
-set(PTHREAD_PUBLIC_HEADERS pthread.h sched.h semaphore.h)
-
-set(PTHREAD_SHARED_SOURCES
- autostatic.c
- barrier.c
- cancel.c
- cleanup.c
- condvar.c
- create.c
- dll.c
- errno.c
- exit.c
- fork.c
- global.c
- misc.c
- mutex.c
- nonportable.c
- private.c
- rwlock.c
- sched.c
- semaphore.c
- signal.c
- spin.c
- sync.c
- tsd.c
- attr.C
- version.rc
-)
-set(PTHREAD_STATIC_SOURCES
- autostatic.c
- cleanup.c
- create.c
- dll.c
- errno.c
- fork.c
- global.c
- pthread_attr_destroy.c
- pthread_attr_getdetachstate.c
- pthread_attr_getinheritsched.c
- pthread_attr_getschedparam.c
- pthread_attr_getschedpolicy.c
- pthread_attr_getscope.c
- pthread_attr_getstackaddr.c
- pthread_attr_getstacksize.c
- pthread_attr_init.c
- pthread_attr_setdetachstate.c
- pthread_attr_setinheritsched.c
- pthread_attr_setschedparam.c
- pthread_attr_setschedpolicy.c
- pthread_attr_setscope.c
- pthread_attr_setstackaddr.c
- pthread_attr_setstacksize.c
- pthread_barrier_destroy.c
- pthread_barrier_init.c
- pthread_barrier_wait.c
- pthread_barrierattr_destroy.c
- pthread_barrierattr_getpshared.c
- pthread_barrierattr_init.c
- pthread_barrierattr_setpshared.c
- pthread_cancel.c
- pthread_cond_destroy.c
- pthread_cond_init.c
- pthread_cond_signal.c
- pthread_cond_wait.c
- pthread_condattr_destroy.c
- pthread_condattr_getpshared.c
- pthread_condattr_init.c
- pthread_condattr_setpshared.c
- pthread_delay_np.c
- pthread_detach.c
- pthread_equal.c
- pthread_exit.c
- pthread_getconcurrency.c
- pthread_getschedparam.c
- pthread_getspecific.c
- pthread_getunique_np.c
- pthread_getw32threadhandle_np.c
- pthread_join.c
- pthread_key_create.c
- pthread_key_delete.c
- pthread_kill.c
- pthread_mutex_consistent.c
- pthread_mutex_destroy.c
- pthread_mutex_init.c
- pthread_mutex_lock.c
- pthread_mutex_timedlock.c
- pthread_mutex_trylock.c
- pthread_mutex_unlock.c
- pthread_mutexattr_destroy.c
- pthread_mutexattr_getkind_np.c
- pthread_mutexattr_getpshared.c
- pthread_mutexattr_getrobust.c
- pthread_mutexattr_gettype.c
- pthread_mutexattr_init.c
- pthread_mutexattr_setkind_np.c
- pthread_mutexattr_setpshared.c
- pthread_mutexattr_setrobust.c
- pthread_mutexattr_settype.c
- pthread_num_processors_np.c
- pthread_once.c
- pthread_rwlock_destroy.c
- pthread_rwlock_init.c
- pthread_rwlock_rdlock.c
- pthread_rwlock_tryrdlock.c
- pthread_rwlock_trywrlock.c
- pthread_rwlock_unlock.c
- pthread_rwlock_wrlock.c
- pthread_rwlockattr_destroy.c
- pthread_rwlockattr_getpshared.c
- pthread_rwlockattr_init.c
- pthread_rwlockattr_setpshared.c
- pthread_self.c
- pthread_setcancelstate.c
- pthread_setcanceltype.c
- pthread_setconcurrency.c
- pthread_setschedparam.c
- pthread_setspecific.c
- pthread_spin_destroy.c
- pthread_spin_init.c
- pthread_spin_lock.c
- pthread_spin_trylock.c
- pthread_spin_unlock.c
- pthread_testcancel.c
- pthread_timechange_handler_np.c
- pthread_win32_attach_detach_np.c
- ptw32_calloc.c
- ptw32_callUserDestroyRoutines.c
- ptw32_cond_check_need_init.c
- ptw32_getprocessors.c
- ptw32_is_attr.c
- ptw32_MCS_lock.c
- ptw32_mutex_check_need_init.c
- ptw32_new.c
- ptw32_processInitialize.c
- ptw32_processTerminate.c
- ptw32_relmillisecs.c
- ptw32_reuse.c
- ptw32_rwlock_check_need_init.c
- ptw32_semwait.c
- ptw32_spinlock_check_need_init.c
- ptw32_threadDestroy.c
- ptw32_threadStart.c
- ptw32_throw.c
- ptw32_timespec.c
- ptw32_tkAssocCreate.c
- ptw32_tkAssocDestroy.c
- sched_get_priority_max.c
- sched_get_priority_min.c
- sched_getscheduler.c
- sched_setscheduler.c
- sched_yield.c
- sem_close.c
- sem_destroy.c
- sem_getvalue.c
- sem_init.c
- sem_open.c
- sem_post_multiple.c
- sem_post.c
- sem_timedwait.c
- sem_trywait.c
- sem_unlink.c
- sem_wait.c
- signal.c
- w32_CancelableWait.c
-)
-
-
-
-add_definitions(-DPTW32_ARCH="${PTW32_ARCH}" -DPTW32_RC_MSC -DHAVE_PTW32_CONFIG_H -D_TIMESPEC_DEFINED)
-
-if(BUILD_SHARED_LIBS)
- set(PTHREAD_SOURCES ${PTHREAD_SHARED_SOURCES})
- add_definitions(-DPTW32_BUILD)
-else()
- set(PTHREAD_SOURCES ${PTHREAD_STATIC_SOURCES})
- add_definitions(-DPTW32_STATIC_LIB)
-endif()
-
-
-if(PTHREADS_BUILD_CPP)
- set(PTHREADS_EXCEPTION_SCHEME CE)
- add_definitions(/__CLEANUP_CXX)
-elseif(PTHREADS_BUILD_SEH)
- set(PTHREADS_EXCEPTION_SCHEME SE)
- add_definitions(/__CLEANUP_SEH)
-else()
- set(PTHREADS_EXCEPTION_SCHEME C)
-endif()
-
-set(PTHREADS_COMPATIBILITY_VERSION 2)
-set(CMAKE_DEBUG_POSTFIX d)
-set(PTHREADS_COMPILER V)
-
-set(PTHREADS_LIBRARY "pthread${PTHREADS_COMPILER}${PTHREADS_EXCEPTION_SCHEME}${PTHREADS_COMPATIBILITY_VERSION}")
-
-add_library(pthreads ${PTHREAD_SOURCES})
-target_include_directories(pthreads PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
-set_target_properties(pthreads PROPERTIES OUTPUT_NAME ${PTHREADS_LIBRARY})
-if(NOT DISABLE_INSTALL_HEADERS)
- set_property(TARGET pthreads PROPERTY PUBLIC_HEADER ${PTHREAD_PUBLIC_HEADERS})
-endif()
-
-install(
- TARGETS pthreads EXPORT pthreads-config
- RUNTIME DESTINATION bin
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION lib
- PUBLIC_HEADER DESTINATION include
- INCLUDES DESTINATION include
-)
-install(EXPORT pthreads-config DESTINATION share/pthreads)
-
diff --git a/ports/pthreads/CONTROL b/ports/pthreads/CONTROL
index d22280d90..a2fa46f02 100644
--- a/ports/pthreads/CONTROL
+++ b/ports/pthreads/CONTROL
@@ -1,3 +1,3 @@
Source: pthreads
-Version: 2.9.1-5
+Version: 3.0.0
Description: pthreads for windows
diff --git a/ports/pthreads/portfile.cmake b/ports/pthreads/portfile.cmake
index 43489adb6..4cb157da6 100644
--- a/ports/pthreads/portfile.cmake
+++ b/ports/pthreads/portfile.cmake
@@ -6,49 +6,85 @@ if(VCPKG_CMAKE_SYSTEM_NAME)
return()
endif()
+set(PTHREADS4W_VERSION "3.0.0")
+
include(vcpkg_common_functions)
-set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/pthreads-w32-2-9-1-release)
vcpkg_download_distfile(ARCHIVE
- URLS "https://www.mirrorservice.org/sites/sourceware.org/pub/pthreads-win32/pthreads-w32-2-9-1-release.tar.gz"
- FILENAME "pthreads-w32-2-9-1-release.tar.gz"
- SHA512 9c06e85310766834370c3dceb83faafd397da18a32411ca7645c8eb6b9495fea54ca2872f4a3e8d83cb5fdc5dea7f3f0464be5bb9af3222a6534574a184bd551
+ URLS "https://sourceforge.net/projects/pthreads4w/files/pthreads4w-code-v${PTHREADS4W_VERSION}.zip/download"
+ FILENAME "pthreads4w-code-v${PTHREADS4W_VERSION}.zip"
+ SHA512 49e541b66c26ddaf812edb07b61d0553e2a5816ab002edc53a38a897db8ada6d0a096c98a9af73a8f40c94283df53094f76b429b09ac49862465d8697ed20013
+)
+
+vcpkg_extract_source_archive_ex(
+ OUT_SOURCE_PATH SOURCE_PATH
+ ARCHIVE ${ARCHIVE}
+ REF ${PTHREADS4W_VERSION}
)
-vcpkg_extract_source_archive(${ARCHIVE})
-file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
+find_program(NMAKE nmake REQUIRED)
-vcpkg_configure_cmake(
- SOURCE_PATH ${SOURCE_PATH}
- PREFER_NINJA
- OPTIONS -DPTW32_ARCH=${VCPKG_TARGET_ARCHITECTURE}
- OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=ON
+################
+# Release build
+################
+message(STATUS "Building ${TARGET_TRIPLET}-rel")
+file(TO_NATIVE_PATH "${CURRENT_PACKAGES_DIR}" INST_DIR_REL)
+vcpkg_execute_required_process(
+ COMMAND ${NMAKE} -f Makefile all install
+ "DESTROOT=\"${INST_DIR_REL}\""
+ WORKING_DIRECTORY ${SOURCE_PATH}
+ LOGNAME nmake-build-${TARGET_TRIPLET}-release
)
+message(STATUS "Building ${TARGET_TRIPLET}-rel done")
-vcpkg_install_cmake()
+################
+# Debug build
+################
+message(STATUS "Building ${TARGET_TRIPLET}-dbg")
+file(TO_NATIVE_PATH "${CURRENT_PACKAGES_DIR}/debug" INST_DIR_DBG)
+vcpkg_execute_required_process(
+ COMMAND ${NMAKE} /G -f Makefile all install
+ "DESTROOT=\"${INST_DIR_DBG}\""
+ WORKING_DIRECTORY ${SOURCE_PATH}
+ LOGNAME nmake-build-${TARGET_TRIPLET}-debug
+)
+message(STATUS "Building ${TARGET_TRIPLET}-dbg done")
-vcpkg_fixup_cmake_targets()
+file(REMOVE "${CURRENT_PACKAGES_DIR}/bin/pthreadVC3d.dll")
+file(REMOVE "${CURRENT_PACKAGES_DIR}/bin/pthreadVCE3d.dll")
+file(REMOVE "${CURRENT_PACKAGES_DIR}/bin/pthreadVSE3d.dll")
+file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/bin/pthreadVC3.dll")
+file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/bin/pthreadVCE3.dll")
+file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/bin/pthreadVSE3.dll")
+file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/libpthreadVC3d.lib")
+file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/libpthreadVCE3d.lib")
+file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/libpthreadVSE3d.lib")
+file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/lib/libpthreadVC3.lib")
+file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/lib/libpthreadVCE3.lib")
+file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/lib/libpthreadVSE3.lib")
-vcpkg_copy_pdbs()
+if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
+ file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/libpthreadVC3.lib")
+ file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/libpthreadVCE3.lib")
+ file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/libpthreadVSE3.lib")
+ file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/lib/libpthreadVC3d.lib")
+ file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/lib/libpthreadVCE3d.lib")
+ file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/lib/libpthreadVSE3d.lib")
+endif()
-file(GLOB HEADERS "${CURRENT_PACKAGES_DIR}/include/*.h")
-foreach(HEADER ${HEADERS})
- file(READ "${HEADER}" _contents)
- string(REPLACE "defined(_TIMESPEC_DEFINED)" "1" _contents "${_contents}")
- string(REPLACE "defined(PTW32_RC_MSC)" "1" _contents "${_contents}")
- if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
- string(REPLACE "!defined(PTW32_STATIC_LIB)" "0" _contents "${_contents}")
- endif()
- file(WRITE "${HEADER}" "${_contents}")
-endforeach()
+if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin")
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin")
+ file(RENAME ${CURRENT_PACKAGES_DIR}/lib/libpthreadVC3.lib ${CURRENT_PACKAGES_DIR}/lib/pthreadVC3.lib)
+ file(RENAME ${CURRENT_PACKAGES_DIR}/lib/libpthreadVCE3.lib ${CURRENT_PACKAGES_DIR}/lib/pthreadVCE3.lib)
+ file(RENAME ${CURRENT_PACKAGES_DIR}/lib/libpthreadVSE3.lib ${CURRENT_PACKAGES_DIR}/lib/pthreadVSE3.lib)
+ file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libpthreadVC3d.lib ${CURRENT_PACKAGES_DIR}/debug/lib/pthreadVC3d.lib)
+ file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libpthreadVCE3d.lib ${CURRENT_PACKAGES_DIR}/debug/lib/pthreadVCE3d.lib)
+ file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libpthreadVSE3d.lib ${CURRENT_PACKAGES_DIR}/debug/lib/pthreadVSE3d.lib)
+endif()
-file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/pthreads RENAME copyright)
-file(INSTALL
- ${CURRENT_PACKAGES_DIR}/lib/pthreadVC2.lib
- DESTINATION ${CURRENT_PACKAGES_DIR}/lib/manual-link
- RENAME pthread.lib
-)
-file(INSTALL
- ${CURRENT_PACKAGES_DIR}/debug/lib/pthreadVC2d.lib
- DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link
- RENAME pthread.lib
-)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/pthreads RENAME copyright)
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/pthread)
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/pthreads)
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/pthreads_windows)
diff --git a/ports/pthreads/vcpkg-cmake-wrapper.cmake b/ports/pthreads/vcpkg-cmake-wrapper.cmake
new file mode 100644
index 000000000..ec5c473fb
--- /dev/null
+++ b/ports/pthreads/vcpkg-cmake-wrapper.cmake
@@ -0,0 +1,218 @@
+#.rst:
+# PThreads4W config wrap for vcpkg
+# ------------
+#
+# Find the PThread4W includes and library.
+#
+# Result Variables
+# ^^^^^^^^^^^^^^^^
+#
+# This script defines the following variables:
+#
+# ``PThreads4W_FOUND``
+# True if PThreads4W library found
+#
+# ``PThreads4W_VERSION``
+# Containing the PThreads4W version tag (manually defined)
+#
+# ``PThreads4W_INCLUDE_DIR``
+# Location of PThreads4W headers
+#
+# ``PThreads4W_LIBRARY``
+# List of libraries to link with when using PThreads4W (no exception handling)
+#
+# ``PThreads4W_CXXEXC_LIBRARY``
+# List of libraries to link with when using PThreads4W (C++ exception handling)
+#
+# ``PThreads4W_STRUCTEXC_LIBRARY``
+# List of libraries to link with when using PThreads4W (struct exception handling)
+#
+# Result Targets
+# ^^^^^^^^^^^^^^^^
+#
+# This script defines the following targets:
+#
+# ``PThreads4W::PThreads4W``
+# Target to use PThreads4W (no exception handling)
+#
+# ``PThreads4W::PThreads4W_CXXEXC``
+# Target to use PThreads4W (C++ exception handling)
+#
+# ``PThreads4W::PThreads4W_STRUCTEXC``
+# Target to use PThreads4W (struct exception handling)
+#
+
+include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
+include(${CMAKE_ROOT}/Modules/SelectLibraryConfigurations.cmake)
+
+if(NOT PThreads4W_INCLUDE_DIR)
+ find_path(PThreads4W_INCLUDE_DIR NAMES pthread.h)
+endif()
+
+set(PThreads4W_MAJOR_VERSION 3)
+set(PThreads4W_MINOR_VERSION 0)
+set(PThreads4W_PATCH_VERSION 0)
+set(PThreads_VERSION "${PThreads4W_MAJOR_VERSION}.${PThreads4W_MINOR_VERSION}.${PThreads4W_PATCH_VERSION}")
+
+# Allow libraries to be set manually
+if(NOT PThreads4W_LIBRARY)
+ find_library(PThreads4W_LIBRARY_RELEASE NAMES pthreadVC${PThreads4W_MAJOR_VERSION})
+ find_library(PThreads4W_LIBRARY_DEBUG NAMES pthreadVC${PThreads4W_MAJOR_VERSION}d)
+ select_library_configurations(PThreads4W)
+endif()
+if(NOT PThreads4W_CXXEXC_LIBRARY)
+ find_library(PThreads4W_CXXEXC_LIBRARY_RELEASE NAMES pthreadVCE${PThreads4W_MAJOR_VERSION})
+ find_library(PThreads4W_CXXEXC_LIBRARY_DEBUG NAMES pthreadVCE${PThreads4W_MAJOR_VERSION}d)
+ select_library_configurations(PThreads4W_CXXEXC)
+endif()
+if(NOT PThreads4W_STRUCTEXC_LIBRARY)
+ find_library(PThreads4W_STRUCTEXC_LIBRARY_RELEASE NAMES pthreadVSE${PThreads4W_MAJOR_VERSION})
+ find_library(PThreads4W_STRUCTEXC_LIBRARY_DEBUG NAMES pthreadVSE${PThreads4W_MAJOR_VERSION}d)
+ select_library_configurations(PThreads4W_STRUCTEXC)
+endif()
+if(WIN32)
+ string( REPLACE ".lib" ".dll" PThreads4W_LIBRARY_RELEASE_DLL "${PThreads4W_LIBRARY_RELEASE}" )
+ string( REPLACE ".lib" ".dll" PThreads4W_LIBRARY_DEBUG_DLL "${PThreads4W_LIBRARY_DEBUG}" )
+ string( REPLACE ".lib" ".dll" PThreads4W_CXXEXC_LIBRARY_RELEASE_DLL "${PThreads4W_CXXEXC_LIBRARY_RELEASE}" )
+ string( REPLACE ".lib" ".dll" PThreads4W_CXXEXC_LIBRARY_DEBUG_DLL "${PThreads4W_CXXEXC_LIBRARY_DEBUG}" )
+ string( REPLACE ".lib" ".dll" PThreads4W_STRUCTEXC_LIBRARY_RELEASE_DLL "${PThreads4W_STRUCTEXC_LIBRARY_RELEASE}" )
+ string( REPLACE ".lib" ".dll" PThreads4W_STRUCTEXC_LIBRARY_DEBUG_DLL "${PThreads4W_STRUCTEXC_LIBRARY_DEBUG}" )
+endif()
+
+find_package_handle_standard_args(PThreads4W DEFAULT_MSG PThreads4W_LIBRARY PThreads4W_CXXEXC_LIBRARY PThreads4W_STRUCTEXC_LIBRARY PThreads4W_INCLUDE_DIR)
+mark_as_advanced(PThreads4W_INCLUDE_DIR PThreads4W_LIBRARY PThreads4W_CXXEXC_LIBRARY PThreads4W_STRUCTEXC_LIBRARY)
+
+#Compatibility definitions, deprecated
+set(PTHREAD_INCLUDE_DIR ${PThreads4W_INCLUDE_DIR} CACHE PATH "" FORCE)
+set(PTHREADS_INCLUDE_DIR ${PThreads4W_INCLUDE_DIR} CACHE PATH "" FORCE)
+set(PThreads_windows_INCLUDE_DIR ${PThreads4W_INCLUDE_DIR} CACHE PATH "" FORCE)
+set(PTHREAD_LIBRARIES ${PThreads4W_LIBRARY} CACHE STRING "" FORCE)
+set(PTHREADS_LIBRARIES ${PThreads4W_LIBRARY} CACHE STRING "" FORCE)
+set(PTHREAD_LIBRARY ${PThreads4W_LIBRARY} CACHE STRING "" FORCE)
+set(PTHREADS_LIBRARY ${PThreads4W_LIBRARY} CACHE STRING "" FORCE)
+set(LIBPTHREAD ${PThreads4W_LIBRARY} CACHE STRING "" FORCE)
+set(LIBPTHREADS ${PThreads4W_LIBRARY} CACHE STRING "" FORCE)
+set(PThreads_windows_LIBRARY ${PThreads4W_LIBRARY} CACHE STRING "" FORCE)
+
+
+#TARGETS
+if( PThreads4W_FOUND AND NOT TARGET PThreads4W::PThreads4W_CXXEXC )
+ if( EXISTS "${PThreads4W_CXXEXC_LIBRARY_RELEASE_DLL}" )
+ add_library( PThreads4W::PThreads4W_CXXEXC SHARED IMPORTED )
+ set_target_properties( PThreads4W::PThreads4W_CXXEXC PROPERTIES
+ IMPORTED_LOCATION_RELEASE "${PThreads4W_CXXEXC_LIBRARY_RELEASE_DLL}"
+ IMPORTED_IMPLIB "${PThreads4W_CXXEXC_LIBRARY_RELEASE}"
+ INTERFACE_INCLUDE_DIRECTORIES "${PThreads4W_INCLUDE_DIR}"
+ IMPORTED_CONFIGURATIONS Release
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C" )
+ if( EXISTS "${PThreads4W_CXXEXC_LIBRARY_DEBUG_DLL}" )
+ set_property( TARGET PThreads4W::PThreads4W_CXXEXC APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
+ set_target_properties( PThreads4W::PThreads4W_CXXEXC PROPERTIES
+ IMPORTED_LOCATION_DEBUG "${PThreads4W_CXXEXC_LIBRARY_DEBUG_DLL}"
+ IMPORTED_IMPLIB_DEBUG "${PThreads4W_CXXEXC_LIBRARY_DEBUG}" )
+ endif()
+ else()
+ add_library( PThreads4W::PThreads4W_CXXEXC UNKNOWN IMPORTED )
+ set_target_properties( PThreads4W::PThreads4W_CXXEXC PROPERTIES
+ IMPORTED_LOCATION_RELEASE "${PThreads4W_CXXEXC_LIBRARY_RELEASE}"
+ INTERFACE_INCLUDE_DIRECTORIES "${PThreads4W_INCLUDE_DIR}"
+ IMPORTED_CONFIGURATIONS Release
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C" )
+ if( EXISTS "${PThreads4W_CXXEXC_LIBRARY_DEBUG}" )
+ set_property( TARGET PThreads4W::PThreads4W_CXXEXC APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
+ set_target_properties( PThreads4W::PThreads4W_CXXEXC PROPERTIES
+ IMPORTED_LOCATION_DEBUG "${PThreads4W_CXXEXC_LIBRARY_DEBUG}" )
+ endif()
+ endif()
+endif()
+
+if( PThreads4W_FOUND AND NOT TARGET PThreads4W::PThreads4W_STRUCTEXC )
+ if( EXISTS "${PThreads4W_STRUCTEXC_LIBRARY_RELEASE_DLL}" )
+ add_library( PThreads4W::PThreads4W_STRUCTEXC SHARED IMPORTED )
+ set_target_properties( PThreads4W::PThreads4W_STRUCTEXC PROPERTIES
+ IMPORTED_LOCATION_RELEASE "${PThreads4W_STRUCTEXC_LIBRARY_RELEASE_DLL}"
+ IMPORTED_IMPLIB "${PThreads4W_STRUCTEXC_LIBRARY_RELEASE}"
+ INTERFACE_INCLUDE_DIRECTORIES "${PThreads4W_INCLUDE_DIR}"
+ IMPORTED_CONFIGURATIONS Release
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C" )
+ if( EXISTS "${PThreads4W_STRUCTEXC_LIBRARY_DEBUG_DLL}" )
+ set_property( TARGET PThreads4W::PThreads4W_STRUCTEXC APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
+ set_target_properties( PThreads4W::PThreads4W_STRUCTEXC PROPERTIES
+ IMPORTED_LOCATION_DEBUG "${PThreads4W_STRUCTEXC_LIBRARY_DEBUG_DLL}"
+ IMPORTED_IMPLIB_DEBUG "${PThreads4W_STRUCTEXC_LIBRARY_DEBUG}" )
+ endif()
+ else()
+ add_library( PThreads4W::PThreads4W_STRUCTEXC UNKNOWN IMPORTED )
+ set_target_properties( PThreads4W::PThreads4W_STRUCTEXC PROPERTIES
+ IMPORTED_LOCATION_RELEASE "${PThreads4W_STRUCTEXC_LIBRARY_RELEASE}"
+ INTERFACE_INCLUDE_DIRECTORIES "${PThreads4W_INCLUDE_DIR}"
+ IMPORTED_CONFIGURATIONS Release
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C" )
+ if( EXISTS "${PThreads4W_STRUCTEXC_LIBRARY_DEBUG}" )
+ set_property( TARGET PThreads4W::PThreads4W_STRUCTEXC APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
+ set_target_properties( PThreads4W::PThreads4W_STRUCTEXC PROPERTIES
+ IMPORTED_LOCATION_DEBUG "${PThreads4W_STRUCTEXC_LIBRARY_DEBUG}" )
+ endif()
+ endif()
+endif()
+
+if( PThreads4W_FOUND AND NOT TARGET PThreads4W::PThreads4W )
+ if( EXISTS "${PThreads4W_LIBRARY_RELEASE_DLL}" )
+ add_library( PThreads4W::PThreads4W SHARED IMPORTED )
+ set_target_properties( PThreads4W::PThreads4W PROPERTIES
+ IMPORTED_LOCATION_RELEASE "${PThreads4W_LIBRARY_RELEASE_DLL}"
+ IMPORTED_IMPLIB "${PThreads4W_LIBRARY_RELEASE}"
+ INTERFACE_INCLUDE_DIRECTORIES "${PThreads4W_INCLUDE_DIR}"
+ IMPORTED_CONFIGURATIONS Release
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C" )
+ if( EXISTS "${PThreads4W_LIBRARY_DEBUG_DLL}" )
+ set_property( TARGET PThreads4W::PThreads4W APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
+ set_target_properties( PThreads4W::PThreads4W PROPERTIES
+ IMPORTED_LOCATION_DEBUG "${PThreads4W_LIBRARY_DEBUG_DLL}"
+ IMPORTED_IMPLIB_DEBUG "${PThreads4W_LIBRARY_DEBUG}" )
+ endif()
+ else()
+ add_library( PThreads4W::PThreads4W UNKNOWN IMPORTED )
+ set_target_properties( PThreads4W::PThreads4W PROPERTIES
+ IMPORTED_LOCATION_RELEASE "${PThreads4W_LIBRARY_RELEASE}"
+ INTERFACE_INCLUDE_DIRECTORIES "${PThreads4W_INCLUDE_DIR}"
+ IMPORTED_CONFIGURATIONS Release
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C" )
+ if( EXISTS "${PThreads4W_LIBRARY_DEBUG}" )
+ set_property( TARGET PThreads4W::PThreads4W APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
+ set_target_properties( PThreads4W::PThreads4W PROPERTIES
+ IMPORTED_LOCATION_DEBUG "${PThreads4W_LIBRARY_DEBUG}" )
+ endif()
+ endif()
+endif()
+
+#Compatibility targets, deprecated
+if( PThreads4W_FOUND AND NOT TARGET PThreads_windows::PThreads_windows )
+ if( EXISTS "${PThreads4W_LIBRARY_RELEASE_DLL}" )
+ add_library( PThreads_windows::PThreads_windows SHARED IMPORTED )
+ set_target_properties( PThreads_windows::PThreads_windows PROPERTIES
+ IMPORTED_LOCATION_RELEASE "${PThreads4W_LIBRARY_RELEASE_DLL}"
+ IMPORTED_IMPLIB "${PThreads4W_LIBRARY_RELEASE}"
+ INTERFACE_INCLUDE_DIRECTORIES "${PThreads4W_INCLUDE_DIR}"
+ IMPORTED_CONFIGURATIONS Release
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C" )
+ if( EXISTS "${PThreads4W_LIBRARY_DEBUG_DLL}" )
+ set_property( TARGET PThreads_windows::PThreads_windows APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
+ set_target_properties( PThreads_windows::PThreads_windows PROPERTIES
+ IMPORTED_LOCATION_DEBUG "${PThreads4W_LIBRARY_DEBUG_DLL}"
+ IMPORTED_IMPLIB_DEBUG "${PThreads4W_LIBRARY_DEBUG}" )
+ endif()
+ else()
+ add_library( PThreads_windows::PThreads_windows UNKNOWN IMPORTED )
+ set_target_properties( PThreads_windows::PThreads_windows PROPERTIES
+ IMPORTED_LOCATION_RELEASE "${PThreads4W_LIBRARY_RELEASE}"
+ INTERFACE_INCLUDE_DIRECTORIES "${PThreads4W_INCLUDE_DIR}"
+ IMPORTED_CONFIGURATIONS Release
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C" )
+ if( EXISTS "${PThreads4W_LIBRARY_DEBUG}" )
+ set_property( TARGET PThreads_windows::PThreads_windows APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
+ set_target_properties( PThreads_windows::PThreads_windows PROPERTIES
+ IMPORTED_LOCATION_DEBUG "${PThreads4W_LIBRARY_DEBUG}" )
+ endif()
+ endif()
+endif()