Better fix?

dev
Tomasz Kapuściński 2022-11-26 15:49:39 +01:00
parent 983a9a6e03
commit bedd24801c
1 changed files with 20 additions and 18 deletions

View File

@ -483,27 +483,10 @@ target_include_directories(colobotbase PUBLIC
${CMAKE_CURRENT_BINARY_DIR}
)
if(PLATFORM_WINDOWS)
list(APPEND INTERNAL_SDL_LIBRARIES
$<IF:$<TARGET_EXISTS:SDL2::SDL2>,SDL2::SDL2,SDL2::SDL2-static>
$<IF:$<TARGET_EXISTS:SDL2_image::SDL2_image>,SDL2_image::SDL2_image,SDL2_image::SDL2_image-static>
$<IF:$<TARGET_EXISTS:SDL2_ttf::SDL2_ttf>,SDL2_ttf::SDL2_ttf,SDL2_ttf::SDL2_ttf-static>
)
set(INTERNAL_SDL_MAIN_LIBRARY SDL2::SDL2main)
elseif()
list(APPEND INTERNAL_SDL_LIBRARIES
SDL2::Core
SDL2::Image
SDL2::TTF
)
set(INTERNAL_SDL_MAIN_LIBRARY SDL2::Main)
endif()
# Main libraries
target_link_libraries(colobotbase PUBLIC
CBot
localename
${INTERNAL_SDL_LIBRARIES}
OpenGL::GL
PNG::PNG
GLEW::GLEW
@ -516,6 +499,20 @@ target_link_libraries(colobotbase PUBLIC
nlohmann_json::nlohmann_json
)
if(PLATFORM_WINDOWS)
target_link_libraries(colobotbase PUBLIC
$<IF:$<TARGET_EXISTS:SDL2::SDL2>,SDL2::SDL2,SDL2::SDL2-static>
$<IF:$<TARGET_EXISTS:SDL2_image::SDL2_image>,SDL2_image::SDL2_image,SDL2_image::SDL2_image-static>
$<IF:$<TARGET_EXISTS:SDL2_ttf::SDL2_ttf>,SDL2_ttf::SDL2_ttf,SDL2_ttf::SDL2_ttf-static>
)
elseif()
target_link_libraries(colobotbase PUBLIC
SDL2::Core
SDL2::Image
SDL2::TTF
)
endif()
if(mpg123_FOUND)
target_link_libraries(colobotbase PUBLIC
MPG123::libmpg123
@ -624,7 +621,12 @@ endif()
if(PLATFORM_WINDOWS)
target_sources(colobot PRIVATE ../desktop/colobot.rc)
endif()
target_link_libraries(colobot colobotbase ${INTERNAL_SDL_MAIN_LIBRARY})
if(PLATFORM_WINDOWS)
target_link_libraries(colobot colobotbase SDL2::SDL2main)
elseif()
target_link_libraries(colobot colobotbase SDL2::Main)
endif()
# Install
install(TARGETS colobot RUNTIME DESTINATION ${COLOBOT_INSTALL_BIN_DIR})