diff --git a/development/cmake/LyxPackaging.cmake b/development/cmake/LyxPackaging.cmake index 6983ccc32e..7520ae0cc1 100644 --- a/development/cmake/LyxPackaging.cmake +++ b/development/cmake/LyxPackaging.cmake @@ -41,32 +41,12 @@ elseif(WIN32) set(CPACK_GENERATOR ZIP) set(CPACK_BINARY_ZIP 1) if(MINGW) - get_filename_component(MINGW_BIN_PATH ${CMAKE_CXX_COMPILER} PATH) - if(LYX_XMINGW) - if(LYX_USE_QT MATCHES "QT4") - get_filename_component(mingw_name ${LYX_XMINGW} NAME) - set(MINGW_BIN_PATH ${MINGW_BIN_PATH}/../${mingw_name}/lib) - set(MINGW_LIB_PATH ${MINGW_BIN_PATH}) - else() - set(MINGW_BIN_PATH /usr/lib/gcc/${LYX_XMINGW}/${GCC_VERSION}) - set(MINGW_LIB_PATH /usr/${LYX_XMINGW}/lib) - endif() - endif() - if(EXISTS ${MINGW_BIN_PATH}/libgcc_s_sjlj-1.dll) - list(APPEND runtime ${MINGW_BIN_PATH}/libgcc_s_sjlj-1.dll) - elseif(EXISTS ${MINGW_BIN_PATH}/libgcc_s_seh-1.dll) - list(APPEND runtime ${MINGW_BIN_PATH}/libgcc_s_seh-1.dll) - elseif(EXISTS ${MINGW_BIN_PATH}/libgcc_s_dw2-1.dll) - list(APPEND runtime ${MINGW_BIN_PATH}/libgcc_s_dw2-1.dll) - endif() - if(EXISTS ${MINGW_BIN_PATH}/libstdc++-6.dll) - list(APPEND runtime ${MINGW_BIN_PATH}/libstdc++-6.dll) - endif() - if(EXISTS ${MINGW_LIB_PATH}/libwinpthread-1.dll) - list(APPEND runtime ${MINGW_LIB_PATH}/libwinpthread-1.dll) - endif() + execute_process(COMMAND ${CMAKE_CXX_COMPILER} -print-libgcc-file-name OUTPUT_VARIABLE GCC_LIBGCC OUTPUT_STRIP_TRAILING_WHITESPACE) + get_filename_component(MINGW_RUNTIME_PATH ${GCC_LIBGCC} PATH) + file(GLOB GCC_RUNTIME ${MINGW_RUNTIME_PATH}/*.dll) + list(APPEND runtime ${GCC_RUNTIME} /usr/${LYX_XMINGW}/lib/libwinpthread-1.dll) if(NOT runtime) - message(FATAL_ERROR "No mingw runtime found in ${MINGW_BIN_PATH}") + message(FATAL_ERROR "No mingw runtime found in ${MINGW_RUNTIME_PATH}") endif() if(LYX_USE_QT MATCHES "QT5")