From 5e03978cd7ee81cc5666e789b98a6080d25f5e10 Mon Sep 17 00:00:00 2001 From: Muzychenko Andrey <33288308+k4zmu2a@users.noreply.github.com> Date: Sun, 3 Oct 2021 15:41:57 +0300 Subject: [PATCH] cmake: disabled link to SDL2main. Ref #19. --- CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bee71d1..bea96ee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,9 @@ if(WIN32) set(SDL2_MIXER_PATH "${CMAKE_CURRENT_LIST_DIR}/Libs/SDL2_mixer") endif() +# SDL2main is not needed +set(SDL2_BUILDING_LIBRARY ON) + find_package(SDL2 REQUIRED) FIND_PACKAGE(SDL2_mixer REQUIRED) @@ -186,8 +189,7 @@ target_link_libraries(SpaceCadetPinball ${SDL2_LIBRARY} ${SDL2_MIXER_LIBRARY}) # On Windows, copy DLL to output if(WIN32) - list(GET SDL2_LIBRARY 1 SDL2_LIB_PATH) - get_filename_component(SDL2_DLL_PATH ${SDL2_LIB_PATH} DIRECTORY) + get_filename_component(SDL2_DLL_PATH ${SDL2_LIBRARY} DIRECTORY) get_filename_component(SDL2_MIXER_DLL_PATH ${SDL2_MIXER_LIBRARY} DIRECTORY) message(STATUS "copy paths='${SDL2_DLL_PATH}' '${SDL2_MIXER_DLL_PATH}'") add_custom_command(TARGET SpaceCadetPinball POST_BUILD