cmake: add /Q_no-use-libirc flag when building a no-libc library The new Intel LLVM library needs this because when building SDL2 in release mode.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d30b7f6..b5441b9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1105,6 +1105,10 @@ else()
set(HAVE_STDARG_H 1)
set(HAVE_STDDEF_H 1)
check_include_file(stdint.h HAVE_STDINT_H)
+
+ if(MSVC AND USE_CLANG)
+ check_c_compiler_flag("/Q_no-use-libirc" HAS_Q_NO_USE_LIBIRC )
+ endif()
endif()
endif()
@@ -3317,6 +3321,9 @@ if(SDL_SHARED)
# FIXME: should be added for all architectures (missing symbols for ARM)
target_link_libraries(SDL2 PRIVATE "-nodefaultlib:MSVCRT")
endif()
+ if(HAS_Q_NO_USE_LIBIRC)
+ target_compile_options(SDL2 PRIVATE /Q_no-use-libirc)
+ endif()
endif()
if(APPLE)
# FIXME: Remove SOVERSION in SDL3
@@ -3346,10 +3353,9 @@ if(SDL_SHARED)
if(MSVC AND NOT SDL_LIBC AND NOT MSVC_CLANG AND NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM")
# Don't try to link with the default set of libraries.
if(NOT WINDOWS_STORE)
- set_target_properties(SDL2 PROPERTIES LINK_FLAGS_RELEASE "/NODEFAULTLIB")
- set_target_properties(SDL2 PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB")
+ set_property(TARGET SDL2 APPEND_STRING PROPERTY LINK_FLAGS " /NODEFAULTLIB")
endif()
- set_target_properties(SDL2 PROPERTIES STATIC_LIBRARY_FLAGS "/NODEFAULTLIB")
+ set_property(TARGET SDL2 APPEND_STRING PROPERTY STATIC_LIBRARY_FLAGS " /NODEFAULTLIB")
endif()
# FIXME: if CMAKE_VERSION >= 3.13, use target_link_options for EXTRA_LDFLAGS
target_link_libraries(SDL2 PRIVATE ${EXTRA_LIBS} ${EXTRA_LDFLAGS} ${EXTRA_LDFLAGS_BUILD} ${CMAKE_DEPENDS})