我正在编写一个CMake工具链文件,用于在Linux上使用MSVC编译器进行编译:
set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_C_COMPILER "cl")
set(CMAKE_CXX_COMPILER "cl")
~/bin/cl
文件:
wine cmd /c Z:/home/velkan/bin/cl.bat "$@"
~/bin/cl.bat
文件:
call Z:\home\velkan\bin\vcvars32.bat
cl %*
~/bin/vcvars32.bat
文件:
@echo off
Set INCLUDE=C:\vc\include;C:\sdk\Include;C:\kits\10\Include\10.0.10586.0\ucrt;%INCLUDE%
Set LIB=C:\vc\lib;C:\sdk\Lib;C:\kits\10\Lib\10.0.10586.0\ucrt\x86;%LIB%
将所有需要的东西复制到wine目录中,因此编译器可以工作。
但是当我运行cmake时,它会将类似/home/velkan/build/CMakeFiles/CMakeTmp/testCCompiler.c
的Unix风格路径传递给编译器。工具链定义是否有任何CMake解决方法可以将它们无缝转换为Z:/home/velkan/build/CMakeFiles/CMakeTmp/testCCompiler.c
之类的内容?