mirror of
https://github.com/yuzu-emu/discord-rpc.git
synced 2024-11-27 12:04:14 +01:00
fix debug build with static crt
CMAKE_BUILD_TYPE is not set at configuration time, so we can't test against it. So, we string-replace /MD with /MT in the c[xx] flags for the different targets. CF: https://stackoverflow.com/questions/14172856/cmake-compile-with-mt-instead-of-md
This commit is contained in:
parent
265ea814f5
commit
2d0661c906
@ -29,16 +29,18 @@ if(WIN32)
|
||||
set(BASE_RPC_SRC ${BASE_RPC_SRC} connection_win.cpp discord_register_win.cpp)
|
||||
add_library(discord-rpc ${BASE_RPC_SRC})
|
||||
if (MSVC)
|
||||
set(CRT_FLAGS)
|
||||
if(USE_STATIC_CRT)
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(CRT_FLAGS /MTd)
|
||||
else()
|
||||
set(CRT_FLAGS /MT)
|
||||
endif()
|
||||
foreach(CompilerFlag
|
||||
CMAKE_CXX_FLAGS
|
||||
CMAKE_CXX_FLAGS_DEBUG
|
||||
CMAKE_CXX_FLAGS_RELEASE
|
||||
CMAKE_C_FLAGS
|
||||
CMAKE_C_FLAGS_DEBUG
|
||||
CMAKE_C_FLAGS_RELEASE)
|
||||
string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
|
||||
endforeach()
|
||||
endif(USE_STATIC_CRT)
|
||||
target_compile_options(discord-rpc PRIVATE /EHsc
|
||||
${CRT_FLAGS}
|
||||
/Wall
|
||||
/wd4100 # unreferenced formal parameter
|
||||
/wd4514 # unreferenced inline
|
||||
|
Loading…
Reference in New Issue
Block a user