From 3273f40db99b7a3c106926431aa1ca501fd951be Mon Sep 17 00:00:00 2001 From: jolavillette Date: Sat, 23 May 2026 08:24:19 +0200 Subject: [PATCH] build(cmake): hide console on Windows in Release --- retroshare-gui/CMakeLists.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/retroshare-gui/CMakeLists.txt b/retroshare-gui/CMakeLists.txt index 8787a794f..438f89719 100644 --- a/retroshare-gui/CMakeLists.txt +++ b/retroshare-gui/CMakeLists.txt @@ -141,7 +141,16 @@ if(WIN32) list(APPEND RS_GUI_SOURCES src/gui/images/retroshare_win.rc) endif() -add_executable(${PROJECT_NAME} ${RS_GUI_SOURCES} ${RS_IMPLEMENTATION_HEADERS} ${RS_UI_HEADERS} ${RS_GUI_QTRESOURCES}) +set(GUI_TYPE "") +if(WIN32) + # Hide the console window on Windows for production builds (Release), + # but keep it visible for Debug and Development builds to view stdout/stderr logs. + if(NOT RS_DEVELOPMENT_BUILD AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug") + set(GUI_TYPE WIN32) + endif() +endif() + +add_executable(${PROJECT_NAME} ${GUI_TYPE} ${RS_GUI_SOURCES} ${RS_IMPLEMENTATION_HEADERS} ${RS_UI_HEADERS} ${RS_GUI_QTRESOURCES}) set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_NAME "retroshare") set_target_properties(${PROJECT_NAME} PROPERTIES ENABLE_EXPORTS TRUE) if(WIN32)