libzt
libzt copied to clipboard
/EHsc compiler flag is invalid for MinGW
Using the MinGW compiler to compile DevilutionX against the latest libzt codebase, I get the following error.
$ make zt-static
[ 0%] Building CXX object _deps/libzt-build/CMakeFiles/zt_pic.dir/src/Central.cpp.obj
x86_64-w64-mingw32-g++: error: /EHsc: No such file or directory
make[3]: *** [_deps/libzt-build/CMakeFiles/zt_pic.dir/build.make:77: _deps/libzt-build/CMakeFiles/zt_pic.dir/src/Central.cpp.obj] Error 1
make[2]: *** [CMakeFiles/Makefile2:1906: _deps/libzt-build/CMakeFiles/zt_pic.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:1969: _deps/libzt-build/CMakeFiles/zt-static.dir/rule] Error 2
make: *** [Makefile:891: zt-static] Error 2
The /EHsc compiler flag is being interpreted as a file path. It's being added to the CMAKE_CXX_FLAGS variable on line 381 of CMakeLists.txt.
https://github.com/zerotier/libzt/blob/41eb9aebc80a5f1c816fa26a06cefde9de906676/CMakeLists.txt#L379-L381
Just as an FYI in case it helps, the DevilutionX project discriminates between MSVC and other platforms using the following conditional statement.
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")