fix MinGW build on Windows

This commit is contained in:
Peter Kümmel 2015-12-15 13:08:48 +01:00
parent 6cc83c5072
commit 11f9c71d75
2 changed files with 16 additions and 4 deletions

View File

@ -198,7 +198,8 @@ if(LYX_USE_QT MATCHES "QT5")
endif()
if (Qt5WinExtras_FOUND)
get_target_property(_winextra_prop Qt5::WinExtras IMPORTED_CONFIGURATIONS)
get_target_property(_winextra_link_libraries Qt5::WinExtras IMPORTED_LOCATION_${_winextra_prop})
string(TOUPPER ${CMAKE_BUILD_TYPE} BUILD_TYPE)
get_target_property(_winextra_link_libraries Qt5::WinExtras IMPORTED_LOCATION_${BUILD_TYPE})
set(CMAKE_REQUIRED_LIBRARIES ${_winextra_link_libraries})
set(CMAKE_REQUIRED_INCLUDES ${Qt5WinExtras_INCLUDE_DIRS})
set(CMAKE_REQUIRED_FLAGS ${Qt5WinExtras_EXECUTABLE_COMPILE_FLAGS})

View File

@ -41,10 +41,21 @@ elseif(WIN32)
set(CPACK_GENERATOR ZIP)
set(CPACK_BINARY_ZIP 1)
if(MINGW)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -print-libgcc-file-name OUTPUT_VARIABLE GCC_LIBGCC OUTPUT_STRIP_TRAILING_WHITESPACE)
set(runtime)
if(LYX_XMINGW)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -print-libgcc-file-name OUTPUT_VARIABLE GCC_LIBGCC OUTPUT_STRIP_TRAILING_WHITESPACE)
list(APPEND runtime /usr/${LYX_XMINGW}/lib/libwinpthread-1.dll)
else()
set(GCC_LIBGCC ${CMAKE_CXX_COMPILER})
endif()
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)
macro(add_runtime_dll _DLL)
file(GLOB GCC_RUNTIME ${MINGW_RUNTIME_PATH}/${_DLL})
list(APPEND runtime ${GCC_RUNTIME})
endmacro()
add_runtime_dll(libgcc*.dll)
add_runtime_dll(libstd*.dll)
add_runtime_dll(libwin*.dll)
if(NOT runtime)
message(FATAL_ERROR "No mingw runtime found in ${MINGW_RUNTIME_PATH}")
endif()