我已经写了我自己的解决方案wine
WineCTestWrapper.cmake:
macro (add_wine_test_wrapper_script TEST)
set(TESTNAME ${TEST})
configure_file (
${PROJECT_SOURCE_DIR}/thirdparty/cmake/modules/WineCTestWrapper.sh.in
${CMAKE_CURRENT_BINARY_DIR}/${TESTNAME} @ONLY
)
endmacro ()
WineCTestWrapper.sh.in:
#!/bin/bash
# simple wrapper for windows PE-executable format
wine @TESTNAME@.exe
如何使用它:
include(WineCTestWrapper)
...
find_program(WINE_FOUND wine)
add_test(some_test some_test)
if(WINE_FOUND)
add_wine_test_wrapper_script(some_test)
endif()
请注意,默认情况下MXE创建带有 .exe
后缀的可执行文件,并且此解决方案使用此“功能”
更新
另一种可能的解决方案https://cmake.org/pipermail/cmake/2008-August/023534.html