icons: Update application icons for Quassel
[quassel.git] / src / main / CMakeLists.txt
index b5aa963..a3ad83d 100644 (file)
@@ -1,13 +1,3 @@
-# Convenience function to avoid boilerplate
-function(setup_executable _target _define)
-    set_target_properties(${_target} PROPERTIES
-        COMPILE_FLAGS ${_define}
-        RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
-    )
-    target_link_libraries(${_target} PRIVATE ${ARGN})
-    install(TARGETS ${_target} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
-endfunction()
-
 if (HAVE_UMASK)
     set_property(SOURCE main.cpp APPEND PROPERTY COMPILE_DEFINITIONS HAVE_UMASK)
 endif()
@@ -33,54 +23,23 @@ if(WIN32)
     endif()
 endif()
 
-
 # Build the executables
 if (WANT_CORE)
-    add_executable(quasselcore main.cpp ${WIN_RC})
-    setup_executable(quasselcore -DBUILD_CORE Qt5::Core Quassel::Core)
+    quassel_add_executable(quasselcore COMPONENT Core SOURCES main.cpp ${WIN_RC} LIBRARIES Qt5::Core Quassel::Core)
 endif()
 
 if (WANT_QTCLIENT)
-    add_executable(quasselclient WIN32 main.cpp ${WIN_RC})
-    setup_executable(quasselclient -DBUILD_QTUI Qt5::Core Qt5::Gui Quassel::QtUi)
+    set(libs Qt5::Core Qt5::Gui Quassel::QtUi)
     if (WITH_KDE)
-        target_link_libraries(quasselclient PRIVATE KF5::CoreAddons)
+        list(APPEND libs KF5::CoreAddons)
     endif()
+    quassel_add_executable(quasselclient COMPONENT Client SOURCES main.cpp ${WIN_RC} LIBRARIES ${libs})
 endif()
 
 if (WANT_MONO)
-    add_executable(quassel WIN32 main.cpp monoapplication.cpp ${WIN_RC})
-    setup_executable(quassel -DBUILD_MONO Qt5::Core Qt5::Gui Quassel::Core Quassel::QtUi)
+    set(libs Qt5::Core Qt5::Gui Quassel::Core Quassel::QtUi)
     if (WITH_KDE)
-        target_link_libraries(quassel PRIVATE KF5::CoreAddons)
-    endif()
-endif()
-
-# Build bundles for MacOSX
-if (APPLE)
-    if (WANT_QTCLIENT)
-        add_custom_command(TARGET quasselclient POST_BUILD
-                           COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makebundle.py
-                                   ${CMAKE_SOURCE_DIR} "Quassel Client" ${CMAKE_BINARY_DIR}/quasselclient)
-    endif()
-    if (WANT_MONO)
-        add_custom_command(TARGET quassel POST_BUILD
-                           COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makebundle.py
-                                   ${CMAKE_SOURCE_DIR} "Quassel" ${CMAKE_BINARY_DIR}/quassel)
-    endif()
-
-    if (DEPLOY)
-        if (WANT_QTCLIENT)
-            add_custom_command(TARGET quasselclient POST_BUILD WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
-                               COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makePackage.sh Client ${CMAKE_BINARY_DIR} qsvgicon)
-        endif()
-        if (WANT_CORE)
-            add_custom_command(TARGET quasselcore POST_BUILD WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
-                               COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makePackage.sh Core ${CMAKE_BINARY_DIR})
-        endif()
-        if (WANT_MONO)
-            add_custom_command(TARGET quassel POST_BUILD WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
-                               COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makePackage.sh Mono ${CMAKE_BINARY_DIR} qsvgicon)
-        endif()
+        list(APPEND libs KF5::CoreAddons)
     endif()
+    quassel_add_executable(quassel COMPONENT Mono SOURCES main.cpp monoapplication.cpp ${WIN_RC} LIBRARIES ${libs})
 endif()