From 0be10ce44819621aa529d0f21f3da51bd1245bcd Mon Sep 17 00:00:00 2001 From: QwertyChouskie Date: Sat, 22 Jul 2017 17:17:31 -0700 Subject: [PATCH] Fix MinGW cross-compilation (#2883) * Fix MinGW x64 cross-compilation * Fix MinGW x86 cross-compilation --- cmake/Toolchain-mingw-64bit.cmake | 5 ++++- cmake/Toolchain-mingw.cmake | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cmake/Toolchain-mingw-64bit.cmake b/cmake/Toolchain-mingw-64bit.cmake index 048acad55..369e845a6 100644 --- a/cmake/Toolchain-mingw-64bit.cmake +++ b/cmake/Toolchain-mingw-64bit.cmake @@ -9,8 +9,11 @@ SET(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc-posix) SET(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++-posix) SET(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres) +# figure out folder to look in +execute_process(COMMAND sh -c "ls /usr/lib/gcc/x86_64-w64-mingw32/ | grep posix | tr -d '\n'" OUTPUT_VARIABLE MINGW_DEPS_FOLDER) + # here is the target environment located -SET(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32 /usr/lib/gcc/x86_64-w64-mingw32/4.9-posix ${PROJECT_SOURCE_DIR}/dependencies) +SET(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32 /usr/lib/gcc/x86_64-w64-mingw32/${MINGW_DEPS_FOLDER}/ ${PROJECT_SOURCE_DIR}/dependencies) # adjust the default behaviour of the FIND_XXX() commands: # search headers and libraries in the target environment, search diff --git a/cmake/Toolchain-mingw.cmake b/cmake/Toolchain-mingw.cmake index 9d3337d56..141465228 100644 --- a/cmake/Toolchain-mingw.cmake +++ b/cmake/Toolchain-mingw.cmake @@ -9,8 +9,11 @@ SET(CMAKE_C_COMPILER i686-w64-mingw32-gcc-posix) SET(CMAKE_CXX_COMPILER i686-w64-mingw32-g++-posix) SET(CMAKE_RC_COMPILER i686-w64-mingw32-windres) +# figure out folder to look in +execute_process(COMMAND sh -c "ls /usr/lib/gcc/x86_64-w64-mingw32/ | grep posix | tr -d '\n'" OUTPUT_VARIABLE MINGW_DEPS_FOLDER) + # here is the target environment located -SET(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32 /usr/lib/gcc/i686-w64-mingw32/4.9-posix ${PROJECT_SOURCE_DIR}/dependencies) +SET(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32 /usr/lib/gcc/i686-w64-mingw32/${MINGW_DEPS_FOLDER}/ ${PROJECT_SOURCE_DIR}/dependencies) # adjust the default behaviour of the FIND_XXX() commands: # search headers and libraries in the target environment, search