improve mingw runtime detection

This commit is contained in:
Peter Kümmel 2015-12-09 13:21:31 +01:00
parent 31b5da479d
commit 2ce5ca7fcc

View File

@ -41,32 +41,12 @@ elseif(WIN32)
set(CPACK_GENERATOR ZIP) set(CPACK_GENERATOR ZIP)
set(CPACK_BINARY_ZIP 1) set(CPACK_BINARY_ZIP 1)
if(MINGW) if(MINGW)
get_filename_component(MINGW_BIN_PATH ${CMAKE_CXX_COMPILER} PATH) execute_process(COMMAND ${CMAKE_CXX_COMPILER} -print-libgcc-file-name OUTPUT_VARIABLE GCC_LIBGCC OUTPUT_STRIP_TRAILING_WHITESPACE)
if(LYX_XMINGW) get_filename_component(MINGW_RUNTIME_PATH ${GCC_LIBGCC} PATH)
if(LYX_USE_QT MATCHES "QT4") file(GLOB GCC_RUNTIME ${MINGW_RUNTIME_PATH}/*.dll)
get_filename_component(mingw_name ${LYX_XMINGW} NAME) list(APPEND runtime ${GCC_RUNTIME} /usr/${LYX_XMINGW}/lib/libwinpthread-1.dll)
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()
if(NOT runtime) 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() endif()
if(LYX_USE_QT MATCHES "QT5") if(LYX_USE_QT MATCHES "QT5")