From 23cc8cfe3f5994c8e9b05f79ba284011fadeaed3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20D=C3=BCrrenberger?= Date: Wed, 7 Jan 2015 13:02:53 +0100 Subject: [PATCH] Only link sfml-main for the GUI examples in release mode. --- cmake/Macros.cmake | 2 +- examples/win32/Win32.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cmake/Macros.cmake b/cmake/Macros.cmake index 4c3ed342..0cf88266 100644 --- a/cmake/Macros.cmake +++ b/cmake/Macros.cmake @@ -130,7 +130,7 @@ macro(sfml_add_example target) source_group("" FILES ${THIS_SOURCES}) # create the target - if(THIS_GUI_APP AND SFML_OS_WINDOWS) + if(THIS_GUI_APP AND SFML_OS_WINDOWS AND NOT DEFINED CMAKE_CONFIGURATION_TYPES AND ${CMAKE_BUILD_TYPE} STREQUAL "Release") add_executable(${target} WIN32 ${THIS_SOURCES}) target_link_libraries(${target} sfml-main) else() diff --git a/examples/win32/Win32.cpp b/examples/win32/Win32.cpp index 5df33a84..653ece7e 100644 --- a/examples/win32/Win32.cpp +++ b/examples/win32/Win32.cpp @@ -47,8 +47,10 @@ LRESULT CALLBACK onEvent(HWND handle, UINT message, WPARAM wParam, LPARAM lParam /// \return Error code /// //////////////////////////////////////////////////////////// -INT WINAPI WinMain(HINSTANCE instance, HINSTANCE, LPSTR, INT) +int main() { + HINSTANCE instance = GetModuleHandle(NULL); + // Define a class for our main window WNDCLASS windowClass; windowClass.style = 0;