]> granicus.if.org Git - transmission/commitdiff
Mark GTK and Qt clients as GUI programs on Windows (detach from console)
authorMike Gelfand <mikedld@mikedld.com>
Sun, 4 Jan 2015 10:57:09 +0000 (10:57 +0000)
committerMike Gelfand <mikedld@mikedld.com>
Sun, 4 Jan 2015 10:57:09 +0000 (10:57 +0000)
cmake/TrMacros.cmake
gtk/CMakeLists.txt
qt/CMakeLists.txt

index dfff6ab81dd106f9242ce1fe25ecc36f90955217..2d233882f5a2afe282d21275fc11b372c602815e 100644 (file)
@@ -80,3 +80,11 @@ macro(tr_add_external_auto_library ID LIBNAME)
         set(${ID}_LIBRARIES ${${ID}_LIBRARY})
     endif()
 endmacro()
+
+function(tr_append_target_property TGT PROP VAL)
+    get_target_property(OVAL ${TGT} ${PROP})
+    if(OVAL)
+        set(VAL "${OVAL} ${VAL}")
+    endif()
+    set_target_properties(${TGT} PROPERTIES ${PROP} "${VAL}")
+endfunction()
index 21bceda851c3a4505b7fe2d96931e8ee454604e2..9a2bf109ca11fd22a3d327f310316d1f86dbea9a 100644 (file)
@@ -135,7 +135,7 @@ add_definitions(
     ${GTK_CFLAGS_OTHER}
 )
 
-add_executable(${TR_NAME}-gtk
+add_executable(${TR_NAME}-gtk WIN32
     ${${PROJECT_NAME}_SOURCES}
     ${${PROJECT_NAME}_HEADERS}
     ${${PROJECT_NAME}_DESKTOP_FILE}
@@ -148,6 +148,10 @@ target_link_libraries(${TR_NAME}-gtk
     ${EVENT2_LIBRARIES}
 )
 
+if(MSVC)
+    tr_append_target_property(${TR_NAME}-gtk LINK_FLAGS "/ENTRY:mainCRTStartup")
+endif()
+
 install(TARGETS ${TR_NAME}-gtk DESTINATION ${CMAKE_INSTALL_BINDIR})
 
 set(${PROJECT_NAME}_PUBLIC_ICONS
index e8ef57905911651f223a27c7979118d088a76975..21682393ddf6ba556082ee7e0ebde7bfef50a931 100644 (file)
@@ -163,7 +163,7 @@ add_definitions(
     "-DTRANSLATIONS_DIR=\"${CMAKE_INSTALL_FULL_DATADIR}/${TR_NAME}/translations\""
 )
 
-add_executable(${TR_NAME}-qt
+add_executable(${TR_NAME}-qt WIN32
     ${${PROJECT_NAME}_SOURCES}
     ${${PROJECT_NAME}_UI_SOURCES}
     ${${PROJECT_NAME}_QRC_SOURCES}
@@ -178,6 +178,10 @@ target_link_libraries(${TR_NAME}-qt
     ${EVENT2_LIBRARIES}
 )
 
+if(MSVC)
+    tr_append_target_property(${TR_NAME}-qt LINK_FLAGS "/ENTRY:mainCRTStartup")
+endif()
+
 if(USE_QT5)
     qt5_use_modules(${TR_NAME}-qt ${TR_QT5_MODULES})
 endif()