Fix Windows Clang compile

This commit is contained in:
NepDisk 2025-06-24 07:51:33 -04:00
parent e5f8c4c990
commit fec3c19bd0
5 changed files with 11 additions and 4 deletions

View file

@ -4,7 +4,11 @@ if(("${CMAKE_COMPILER_IS_GNUCC}" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND
target_link_options(SRB2SDL2 PRIVATE "-Wl,--disable-dynamicbase")
if("${SRB2_CONFIG_STATIC_STDLIB}")
# On MinGW with internal libraries, link the standard library statically
target_link_options(SRB2SDL2 PRIVATE -Wl,--add-stdcall-alias -static-libgcc -static-libstdc++ -static -lpthread)
if(CMAKE_LINKER_TYPE STREQUAL "LLD")
target_link_options(SRB2SDL2 PRIVATE -Wl, -static-libgcc -static-libstdc++ -static -lpthread)
else()
target_link_options(SRB2SDL2 PRIVATE -Wl,--add-stdcall-alias -static-libgcc -static-libstdc++ -static -lpthread)
endif()
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)
target_link_libraries(SRB2SDL2 PRIVATE Threads::Threads)

View file

@ -1,9 +1,6 @@
#include <winuser.h>
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#include "winver.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////

View file

@ -5,3 +5,6 @@ set(CMAKE_CXX_COMPILER clang++)
# Set that this is clang.
set(CMAKE_C_COMPILER_ID clang)
set(CMAKE_CXX_COMPILER_ID clang)
# Use LLD to link
set(CMAKE_LINKER_TYPE LLD)

View file

@ -16,3 +16,6 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# search headers and libraries in the target environment
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# Use LLD to link
set(CMAKE_LINKER_TYPE LLD)