Cross-compiling for windows: cmake & mxe: lost in dependencies

I am trying to use cmake and MXE to cross compile for Windows.

Everything works fine on * nix. However, I do not know how to get some of the dependencies (Grantlee5 and Qt5WebKitWidgets) for working with MinGW and cross-compiling. The following is an example (minimal) of my CMakeLists.txt:

cmake_minimum_required(VERSION 2.8.11)
project(MyProject)

set(QT_USE_QTXML TRUE)
set(QT_USE_QTWEBKIT TRUE)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall") 

# Instruct CMake to run moc automaticall when needed.
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

#find packages
find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Xml REQUIRED)
find_package(Grantlee5 REQUIRED)
find_package(Qt5WebKitWidgets REQUIRED) 
find_package(Git)

#(...) add all sources

# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)

# Tell CMake to create the executable
add_executable(MyProjectExec ${SRCS})

target_link_libraries(MyProjectExec
              Qt5::Widgets
              Qt5::Xml
              Grantlee5::Templates
              Qt5::WebKitWidgets
             )

It works fine if I just use "cmake". However, if I use the MXE toolchain to cross-compile for Widnows (i686-w64-mingw32.static-cmake), Grantlee5 and Qt5WebKitWidgets fail with the following message:

Make a mistake in CMakeLists.txt: xx (find_package): could not find the configuration file for the package "Grantlee5", compatible with the requested version "". [So in the original]

, :

/usr/lib/cmake/Grantlee5/Grantlee5Config.cmake, version: 5.0.0 (64bit)

, Grantlee5 Windows/MinGW.

ExternalProject_Add (Grantlee5 GIT_REPOSITORY https://github.com/steveire/grantlee.git) , grantlee, (, windows )

add_library (Grantlee5/usr/local/src/grantlee/) find_library. Grantlee , ( grantlee/engine.h )

cmake Grantlee Qt5WebKitWidgets ( )? "" ?

+4

Source: https://habr.com/ru/post/1629636/


All Articles