mirror of
https://github.com/lifting-bits/remill
synced 2026-06-21 13:56:07 +00:00
Fix XED runtime always defaulting to /MT
This commit is contained in:
committed by
Kyle Elliott
parent
0e324aee8c
commit
ba4c420b50
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
# /Users/admin/Projects/cxx-common/ports/xed/XEDConfig.cmake
|
||||
# Reference: https://github.com/lifting-bits/cxx-common/blob/e0063b2f5986582ed8dcab0c2863abf0893b3082/ports/xed/XEDConfig.cmake
|
||||
|
||||
if(XED_FOUND)
|
||||
return()
|
||||
|
||||
Vendored
+31
@@ -23,6 +23,37 @@ set(MFILE_ARGS
|
||||
"--compiler=${compiler}"
|
||||
)
|
||||
|
||||
# XED is built by mbuild, not CMake, so it does not honor
|
||||
# CMAKE_MSVC_RUNTIME_LIBRARY. mbuild also ties "--static" to /MT by default.
|
||||
# Dna.LLVMInterop and the CMake-built dependencies use the DLL CRT (/MD), so
|
||||
# disable mbuild's implicit CRT flag and pass the matching MSVC runtime flag
|
||||
# explicitly. Without this, xed.lib/xed-ild.lib embed /DEFAULTLIB:libcmt.lib
|
||||
# and the Dna.LLVMInterop link emits LNK4098.
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows" AND MSVC)
|
||||
set(xed_msvc_runtime_flag "")
|
||||
if(DEFINED CMAKE_MSVC_RUNTIME_LIBRARY AND NOT CMAKE_MSVC_RUNTIME_LIBRARY STREQUAL "")
|
||||
if(CMAKE_MSVC_RUNTIME_LIBRARY MATCHES "DebugDLL$")
|
||||
set(xed_msvc_runtime_flag "/MDd")
|
||||
elseif(CMAKE_MSVC_RUNTIME_LIBRARY MATCHES "DLL$")
|
||||
set(xed_msvc_runtime_flag "/MD")
|
||||
elseif(CMAKE_MSVC_RUNTIME_LIBRARY MATCHES "Debug$")
|
||||
set(xed_msvc_runtime_flag "/MTd")
|
||||
else()
|
||||
set(xed_msvc_runtime_flag "/MT")
|
||||
endif()
|
||||
elseif(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(xed_msvc_runtime_flag "/MDd")
|
||||
else()
|
||||
set(xed_msvc_runtime_flag "/MD")
|
||||
endif()
|
||||
|
||||
list(APPEND MFILE_ARGS
|
||||
"--no-mscrt"
|
||||
"--extra-ccflags=${xed_msvc_runtime_flag}"
|
||||
"--extra-cxxflags=${xed_msvc_runtime_flag}"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(CMAKE_OSX_SYSROOT)
|
||||
list(APPEND MFILE_ARGS "--extra-ccflags=-isysroot ${CMAKE_OSX_SYSROOT}")
|
||||
list(APPEND MFILE_ARGS "--extra-cxxflags=-isysroot ${CMAKE_OSX_SYSROOT}")
|
||||
|
||||
Reference in New Issue
Block a user