First some info dump in case it may matter:
- cmake: 3.21.1
- generator: Unix Makefiles
- host: linux
- toolchain: mingw-w64
- toolchain file contains:
set(CMAKE_CROSSCOMPILING_EMULATOR "WINEPATH=Z:\\usr\\x86_64-w64-mingw32\\usr\\bin\\" "/usr/bin/wine")
Winepath is required as there are a few dlls in the cross-root needed for the targets to run.
CMAKE_CROSSCOMPILINGgets properly set to true
There are 2 goals here, the first is to run one of the build targets to generate some data using add_custom_target
add_custom_target(data.zip ALL COMMAND $<TARGET_FILE:myexe> arg1 argN) add_dependencies(data.zip myexe)
How do I get cmake to run the the above using the emulator/wine? Based on scattered snippets in the official docs and SO posts it might just work. Unfortunately it does not. It’s as if the setting is ignored. Tried all sort of stuff, to no avail. Surely missing something possibly obvious.
The second goal is to run unit tests using the emulator by running ctest. The setup works well for native builds. If I run ctest using the cross toolchain file it looks for the test executables in the right place but doesn’t add the required file extension .exe to the path, and again the emulator setting is ignored.