Update CMakeLists.txt

only link iphlpapi if on Windows host
only copy MinGW DLLs if on Windows host
This commit is contained in:
Logan Aerl Arias 2025-02-16 23:05:15 -05:00
parent ae0afa9d52
commit e5c4924e7a

View file

@ -469,7 +469,11 @@ endif()
if(TARGET miniupnpc::miniupnpc)
if("${VCPKG_TARGET_TRIPLET}" MATCHES "-mingw-static$")
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_MINIUPNPC -DMINIUPNP_STATICLIB)
target_link_libraries(SRB2SDL2 PRIVATE miniupnpc::miniupnpc iphlpapi)
if("${VCPKG_HOST_TRIPLET}" MATCHES "-mingw-static$")
target_link_libraries(SRB2SDL2 PRIVATE miniupnpc::miniupnpc iphlpapi)
else()
target_link_libraries(SRB2SDL2 PRIVATE miniupnpc::miniupnpc)
endif()
else()
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_MINIUPNPC)
target_link_libraries(SRB2SDL2 PRIVATE miniupnpc::miniupnpc)
@ -498,7 +502,7 @@ endif()
# copy DLLs to bin/ directory if building internal shared on windows
if("${CMAKE_SYSTEM_NAME}" STREQUAL Windows AND NOT "${SRB2_CONFIG_INTERNAL_LIBRARIES}")
set(ADDITIONAL_DLLS "")
if("${CMAKE_C_COMPILER_ID}" STREQUAL GNU)
if("${CMAKE_C_COMPILER_ID}" STREQUAL GNU AND "${VCPKG_HOST_TRIPLET}" MATCHES "-mingw-static$")
# also copy implicitly linked system libraries
get_filename_component(MINGW_BIN_PATH ${CMAKE_CXX_COMPILER} PATH)
list(APPEND ADDITIONAL_DLLS