From f9962175095b544bc4970fce8bdaa6272ae8ea76 Mon Sep 17 00:00:00 2001 From: xavi92 Date: Mon, 28 Oct 2024 05:56:09 +0000 Subject: [PATCH] customthirdparty.cmake: Optionally install libwinpthread Some flavours of MinGW are built with the `posix` thread model, which require to copy libwinpthread-1.dll to the `bin/` directory, as opposed to those configured with the `win32` thread model. git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@9612 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: d1c08685c33951fb150b94a0343e0d46d001ce4e Former-commit-id: c146217ce9bef791e0cfb41a8ac2bea4e4a07346 --- cmake/customthirdparty.cmake | 14 ++++++++++++++ cmake/install.cmake | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/cmake/customthirdparty.cmake b/cmake/customthirdparty.cmake index 98bf9040a..bb89239cd 100644 --- a/cmake/customthirdparty.cmake +++ b/cmake/customthirdparty.cmake @@ -269,6 +269,14 @@ MACRO(SD_INSTALL_CUSTOM_3RDPARTY TARGET_NAME) "${_MINGW_BINDIR}/*/lib" NO_CMAKE_FIND_ROOT_PATH NO_DEFAULT_PATH) + FIND_FILE(libwinpthread_path "libwinpthread-1.dll" + HINTS + "${_MINGW_BINDIR}/bin" + "${_MINGW_BINDIR}/lib" + "${_MINGW_BINDIR}/*/bin" + "${_MINGW_BINDIR}/*/lib" + NO_CMAKE_FIND_ROOT_PATH + NO_DEFAULT_PATH) IF(libstdcxx_path STREQUAL "libstdcxx_path-NOTFOUND") MESSAGE(FATAL_ERROR "Could not find libstdc++") @@ -284,6 +292,12 @@ MACRO(SD_INSTALL_CUSTOM_3RDPARTY TARGET_NAME) SET(_COMPILER_DLL_PATHNAMES "${libssp_path}") ENDIF() + IF(libwinpthread_path STREQUAL "libwinpthread_path-NOTFOUND") + MESSAGE(STATUS "Could not find libwinpthread. win32 thread model assumed.") + ELSE() + SET(_COMPILER_DLL_PATHNAMES "${libwinpthread_path}") + ENDIF() + SET(_COMPILER_DLL_PATHNAMES ${_COMPILER_DLL_PATHNAMES} "${libstdcxx_path}" diff --git a/cmake/install.cmake b/cmake/install.cmake index ea93119ef..3b2cbece5 100644 --- a/cmake/install.cmake +++ b/cmake/install.cmake @@ -122,6 +122,10 @@ MACRO(SD_UPDATE_SETTINGS_VERSION) LIST(APPEND _DLLS_TO_INSTALL "${libssp_path}") ENDIF() + IF(NOT libwinpthread_path STREQUAL "libwinpthread_path-NOTFOUND") + LIST(APPEND _DLLS_TO_INSTALL "${libwinpthread_path}") + ENDIF() + ENDIF(MINGW AND NOT CMAKE_GENERATOR STREQUAL "MSYS Makefiles") # Copy the dependency DLLs found above.