From 94df40ecfe5cfd3aed595bda0d8cea59f2e6343c Mon Sep 17 00:00:00 2001 From: Louis M Date: Mon, 10 Jun 2024 20:29:31 -0400 Subject: [PATCH] Fix duplicate main in executable linking for Windows --- Aquaria/Main.cpp | 4 ++-- CMakeLists.txt | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Aquaria/Main.cpp b/Aquaria/Main.cpp index 16bf693..753cfda 100644 --- a/Aquaria/Main.cpp +++ b/Aquaria/Main.cpp @@ -87,9 +87,9 @@ static void CheckConfig(void) std::string dsqParam = ""; // fileSystem std::string extraDataDir = ""; std::string appImageExtraDir = ""; - const char *appImageDir = 0; + const char *appImageDir = nullptr; - const char *envPath = 0; + const char *envPath = nullptr; #ifdef BBGE_BUILD_UNIX envPath = getenv("AQUARIA_DATA_PATH"); if (envPath) diff --git a/CMakeLists.txt b/CMakeLists.txt index 613a3cc..300fb08 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -206,11 +206,7 @@ if(NOT SDL_FOUND) set(SDLMAIN_LIBRARY "${SDLDIR}/lib/win32/SDLmain.lib" CACHE FILEPATH "Where the SDLmain library can be found" FORCE) set(SDL_LIBRARY "${SDLDIR}/lib/win32/SDL.lib" CACHE FILEPATH "Where the SDL library can be found" FORCE) endif(AQUARIA_USE_SDL2) - if(MSYS) - set(SDL_LIBRARY -lmingw32 ${SDLMAIN_LIBRARY} ${SDL_LIBRARY}) # not seen by user - else(MSYS) - set(SDL_LIBRARY ${SDLMAIN_LIBRARY} ${SDL_LIBRARY}) # not seen by user - endif(MSYS()) + set(SDL_LIBRARY ${SDLMAIN_LIBRARY} ${SDL_LIBRARY}) # not seen by user else(MACOSX) message(SEND_ERROR "We don't have a prebuilt SDL for this platform.") endif(MACOSX) @@ -813,5 +809,9 @@ ADD_EXECUTABLE(aquaria ${EXETYPE} ) TARGET_LINK_LIBRARIES(aquaria ${OPTIONAL_LIBS}) +IF(WIN32_TRUE) + SET(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} "-static") +ENDIF(WIN32_TRUE) + # end of CMakeLists.txt ...