Set RUNTIME_OUTPUT_DIRECTORY instead of abusing OUTPUT_NAME
[quassel.git] / src / CMakeLists.txt
1 # Builds the three main targets
2
3 add_subdirectory(common)
4 include_directories(BEFORE common)
5 if(BUILD_CORE)
6   add_subdirectory(core)
7   include_directories(BEFORE core)
8 endif()
9 if(BUILD_GUI)
10   add_subdirectory(client)
11   add_subdirectory(uisupport)
12   add_subdirectory(qtui)
13   include_directories(BEFORE client)
14   include_directories(BEFORE uisupport)
15   include_directories(BEFORE qtui)
16
17   if(STATIC)
18     link_directories(${QT_PLUGINS_DIR}/imageformats)
19     set(CLIENT_LIBRARIES ${CLIENT_LIBRARIES} qjpeg qgif)
20   endif()
21 endif()
22
23 include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) # for version.gen
24
25 # We need to initialize the appropriate resources, so let's give our main.cpp some hints
26 if (EMBED_DATA)
27     add_definitions(-DEMBED_DATA)
28 endif()
29
30 # For KAboutData
31 if (WITH_KF5)
32     set(CLIENT_LIBRARIES ${CLIENT_LIBRARIES} KF5::CoreAddons)
33 endif()
34
35 # Needed for showing the cli option if appropriate
36 if (HAVE_SYSLOG)
37     add_definitions(-DHAVE_SYSLOG)
38 endif()
39
40 if(WANT_CORE)
41   add_executable(quasselcore common/main.cpp ${CORE_DEPS} ${COMMON_DEPS})
42   qt_use_modules(quasselcore Core Network ${CORE_QT_MODULES})
43   add_dependencies(quasselcore po)
44   set_target_properties(quasselcore PROPERTIES
45                                     COMPILE_FLAGS "-DBUILD_CORE"
46                                     RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
47   target_link_libraries(quasselcore mod_core mod_common ${COMMON_LIBRARIES} ${QUASSEL_SSL_LIBRARIES} ${QT_QTMAIN_LIBRARY})
48   install(TARGETS quasselcore RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
49 endif()
50
51 if (KDE4_FOUND)
52     include_directories(${KDE4_INCLUDES})
53 endif()
54
55 if(WANT_QTCLIENT)
56   add_executable(quasselclient WIN32 common/main.cpp ${CLIENT_DEPS} ${COMMON_DEPS})
57   qt_use_modules(quasselclient Core Gui Network ${CLIENT_QT_MODULES})
58   add_dependencies(quasselclient po)
59   set_target_properties(quasselclient PROPERTIES
60                                       COMPILE_FLAGS "-DBUILD_QTUI"
61                                       RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
62   target_link_libraries(quasselclient mod_qtui mod_uisupport mod_client mod_common ${COMMON_LIBRARIES} ${CLIENT_LIBRARIES} ${QUASSEL_SSL_LIBRARIES} ${QT_QTMAIN_LIBRARY})
63   install(TARGETS quasselclient RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
64 endif()
65
66 if(WANT_MONO)
67   add_executable(quassel WIN32 common/main.cpp qtui/monoapplication.cpp ${CLIENT_DEPS} ${CORE_DEPS} ${COMMON_DEPS})
68   qt_use_modules(quassel Core Gui Network ${CLIENT_QT_MODULES} ${CORE_QT_MODULES})
69   add_dependencies(quassel po)
70   set_target_properties(quassel PROPERTIES
71                                 COMPILE_FLAGS "-DBUILD_MONO"
72                                 RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
73   target_link_libraries(quassel mod_qtui mod_uisupport mod_client mod_core mod_common ${COMMON_LIBRARIES} ${CLIENT_LIBRARIES} ${QUASSEL_SSL_LIBRARIES} ${QT_QTMAIN_LIBRARY})
74   install(TARGETS quassel RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
75 endif()
76
77 # Build bundles for MacOSX
78 if(APPLE)
79   add_custom_command(TARGET quasselclient POST_BUILD
80                      COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makebundle.py
81                              ${CMAKE_SOURCE_DIR} "Quassel Client" ../quasselclient)
82   add_custom_command(TARGET quassel POST_BUILD
83                      COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makebundle.py
84                              ${CMAKE_SOURCE_DIR} "Quassel" ../quassel)
85   if(DEPLOY)
86     add_custom_command(TARGET quasselclient POST_BUILD
87                        COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makePackage.sh Client .. qsvgicon)
88     add_custom_command(TARGET quasselcore POST_BUILD
89                        COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makePackage.sh Core ..)
90     add_custom_command(TARGET quassel POST_BUILD
91                        COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makePackage.sh Mono .. qsvgicon)
92   endif()
93 endif()