fix link libraries on windows
parent
c2b92c8214
commit
b2ad076e47
|
@ -189,10 +189,22 @@ set(srcs_sdl
|
|||
source/sdl/main_sdl.c
|
||||
source/sdl/snd_sdl.c)
|
||||
|
||||
set(libs
|
||||
m
|
||||
OpenGL::GL
|
||||
${SDL2_LIBRARIES})
|
||||
|
||||
set(defs "")
|
||||
|
||||
list(APPEND srcs ${srcs_sdl})
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
list(APPEND srcs ${srcs_windows})
|
||||
list(APPEND libs winmm)
|
||||
# TODO
|
||||
# list(APPEND libs wsock32)
|
||||
list(APPEND libs ws2_32)
|
||||
list(APPEND defs -D_USE_WINSOCK2)
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
list(APPEND srcs ${srcs_unix} ${srcs_linux})
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
|
@ -205,8 +217,8 @@ add_executable(quake WIN32 ${srcs})
|
|||
|
||||
function(agw_checked_library define library)
|
||||
if(PkgConfig_FOUND AND ${library}_FOUND)
|
||||
target_compile_definitions(quake PUBLIC -D${define}=1)
|
||||
target_link_libraries(quake PkgConfig::${library})
|
||||
list(APPEND defs -D${define}=1)
|
||||
list(APPEND libs PkgConfig::${library})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
@ -216,7 +228,7 @@ agw_checked_library(USE_CODEC_OPUS Opus)
|
|||
agw_checked_library(USE_CODEC_MikMod MikMod)
|
||||
|
||||
if(HAVE_COMPUTED_GOTO)
|
||||
target_compile_definitions(quake PUBLIC -DHAVE_COMPUTED_GOTO=1)
|
||||
list(APPEND defs -DHAVE_COMPUTED_GOTO=1)
|
||||
endif()
|
||||
|
||||
target_compile_options(quake PUBLIC
|
||||
|
@ -225,4 +237,5 @@ target_compile_options(quake PUBLIC
|
|||
$<$<C_COMPILER_ID:MSVC>: /W4>)
|
||||
target_include_directories(quake SYSTEM PUBLIC ${SDL2_INCLUDE_DIRS})
|
||||
target_include_directories(quake PUBLIC source)
|
||||
target_link_libraries(quake m OpenGL::GL ${SDL2_LIBRARIES})
|
||||
target_link_libraries(quake ${libs})
|
||||
target_compile_definitions(quake PUBLIC ${defs})
|
||||
|
|
Loading…
Reference in New Issue