Skip to content

Commit

Permalink
cmake: add /Q_no-use-libirc flag when building a no-libc library
Browse files Browse the repository at this point in the history
The new Intel LLVM library needs this because when building SDL2
in release mode.
  • Loading branch information
madebr committed Mar 27, 2023
1 parent b58285b commit 5e5b029
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions CMakeLists.txt
Expand Up @@ -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()

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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})
Expand Down

0 comments on commit 5e5b029

Please sign in to comment.