cmake: do not use WIN32 for console tools 137/head
authorThomas Debesse <dev@illwieckz.net>
Fri, 5 Jul 2019 20:25:34 +0000 (22:25 +0200)
committerThomas Debesse <dev@illwieckz.net>
Fri, 5 Jul 2019 20:33:33 +0000 (22:33 +0200)
allow them to output stdout on console and spawn a console if required

it's not very intuitive and explicit but the WIN32 cmake keyword
in add_executable call is to not target the console subsystem but
only the graphical one

so console tools just have to not use that keyword, even if they imay
display a window like when doing q2map -glview

then the WIN32 keyword is a kind of “no console” keyword

CMakeLists.txt
radiant/CMakeLists.txt
tools/quake2/CMakeLists.txt
tools/quake2/qdata_heretic2/CMakeLists.txt
tools/quake3/CMakeLists.txt

index 6afa468..1a414aa 100644 (file)
@@ -266,18 +266,6 @@ if (BUILD_BINARIES)
         string(REGEX REPLACE "^[.]" "" RADIANT_EXECUTABLE ${CMAKE_EXECUTABLE_SUFFIX})
     endif ()
 
-    macro (console_app name)
-        if (WIN32)
-            target_link_libraries(${name} -mconsole)
-        endif ()
-    endmacro ()
-
-    macro (window_app name)
-        if (WIN32)
-            target_link_libraries(${name} -mwindows)
-        endif ()
-    endmacro ()
-
     macro (radiant_tool name)
         if (BUNDLE_LIBRARIES AND WIN32)
             add_executable(${name} ${ARGN} ${PROJECT_SOURCE_DIR}/include/lib.rc)
index 144bf32..93fedea 100644 (file)
@@ -128,8 +128,6 @@ target_link_libraries(${RADIANT_BASENAME}
     xmllib
 )
 
-window_app(${RADIANT_BASENAME})
-
 if (X11_LIBRARIES)
     target_link_libraries(${RADIANT_BASENAME} ${X11_LIBRARIES})
 endif ()
index 20d7ff8..b36be1a 100644 (file)
@@ -4,7 +4,7 @@ find_package(LibXml2 REQUIRED)
 include_directories(${LIBXML2_INCLUDE_DIR})
 
 radiant_tool(q2map
-    WIN32 q2map/q2map.rc
+    q2map/q2map.rc
 
     common/bspfile.c common/bspfile.h
     common/cmdlib.c common/cmdlib.h
@@ -46,9 +46,6 @@ radiant_tool(q2map
     q2map/writebsp.c
 )
 
-console_app(q2map)
-window_app(q2map)
-
 target_compile_definitions(q2map
     PRIVATE
 )
@@ -59,7 +56,7 @@ target_link_libraries(q2map
 )
 
 radiant_tool(qdata3
-    WIN32 qdata/qdata.rc
+    qdata/qdata.rc
 
     common/bspfile.c common/bspfile.h
     common/cmdlib.c common/cmdlib.h
@@ -84,8 +81,6 @@ radiant_tool(qdata3
     qdata/video.c
 )
 
-console_app(qdata3)
-
 target_compile_definitions(qdata3
     PRIVATE
 )
index d9c5b43..3413162 100644 (file)
@@ -6,7 +6,7 @@ find_package(LibXml2 REQUIRED)
 include_directories(${LIBXML2_INCLUDE_DIR})
 
 radiant_tool(h2data
-    WIN32 h2data.rc
+    h2data.rc
 
     common/bspfile.c common/bspfile.h
     common/cmdlib.c common/cmdlib.h
@@ -56,8 +56,6 @@ radiant_tool(h2data
     video.c
 )
 
-console_app(h2data)
-
 target_compile_definitions(h2data
     PRIVATE
 )
index d2d3ae2..41af91c 100644 (file)
@@ -60,7 +60,7 @@ set(q3map2_games
         )
 
 radiant_tool(q3map2
-        WIN32 q3map2/q3map2.rc
+        q3map2/q3map2.rc
 
         common/cmdlib.c common/cmdlib.h
         common/imagelib.c common/imagelib.h
@@ -127,8 +127,6 @@ radiant_tool(q3map2
         q3map2/writebsp.c
         )
 
-console_app(q3map2)
-
 if (BUILD_CRUNCH)
         set(OPTIONAL_IMAGE_LIBRARIES crnrgba)
         set(OPTIONAL_IMAGE_DEFINES BUILD_CRUNCH=1)
@@ -157,7 +155,7 @@ target_link_libraries(q3map2
         )
 
 radiant_tool(q3data
-        WIN32 q3data/q3data.rc
+        q3data/q3data.rc
 
         common/aselib.c common/aselib.h
         common/bspfile.c common/bspfile.h
@@ -181,8 +179,6 @@ radiant_tool(q3data
         q3data/video.c
         )
 
-console_app(q3data)
-
 target_link_libraries(q3data
         ${GLIB_LIBRARIES}
         ${LIBXML2_LIBRARIES}