diff --git a/CMakeLists.txt b/CMakeLists.txt index 73b0a8ce8a..96544c8446 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -169,6 +169,31 @@ if (MSVC AND NOT CXX_CLANG) set(CMAKE_CXX_FLAGS_INIT "${CMAKE_CXX_FLAGS_INIT} /W3 /WX-") endif() +# Set runtime library to MD/MDd for all configurations +if(MSVC) + if (YUZU_USE_BUNDLED_QT AND ARCHITECTURE_arm64) + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + set(libflag MT) + else() + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") + set(libflag MD) + endif() + + # Force all projects (including external dependencies) to use the same runtime + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /${libflag}") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /${libflag}d") + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /${libflag}") + set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /${libflag}d") + + # Add this to ensure Cubeb uses the same runtime + add_compile_options( + $<$:/${libflag}d> + $<$:/${libflag}> + $<$:/${libflag}> + $<$:/${libflag}> + ) +endif() + # TODO(crueter): Cleanup, each dep that has a bundled option should allow to choose between bundled, external, system cmake_dependent_option(YUZU_USE_EXTERNAL_SDL2 "Build SDL2 from external source" OFF "NOT MSVC;NOT ANDROID" OFF) cmake_dependent_option(YUZU_USE_BUNDLED_SDL2 "Download bundled SDL2 build" "${MSVC}" "NOT ANDROID" OFF) @@ -688,31 +713,6 @@ if (MSVC AND CXX_CLANG) link_libraries(llvm-mingw-runtime) endif() -# Set runtime library to MD/MDd for all configurations -if(MSVC) - if (YUZU_USE_BUNDLED_QT AND ARCHITECTURE_arm64) - set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") - set(libflag MT) - else() - set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") - set(libflag MD) - endif() - - # Force all projects (including external dependencies) to use the same runtime - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /${libflag}") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /${libflag}d") - set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /${libflag}") - set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /${libflag}d") - - # Add this to ensure Cubeb uses the same runtime - add_compile_options( - $<$:/${libflag}d> - $<$:/${libflag}> - $<$:/${libflag}> - $<$:/${libflag}> - ) -endif() - add_subdirectory(src) # Set yuzu project or yuzu-cmd project as default StartUp Project in Visual Studio depending on whether QT is enabled or not