Adding resource files in multiple targets is a bad idea, because CMake
will happily generate them multiple times too, and unfortunately also
in the same location. With Qt5, this actually lead to a misgenerated
oxygen_kde.qrc some times.
Now we add the resources in the module they belong to, which not only
avoids these race conditions, but also saves some time during compile,
because every resource file is only processed once now.
Changing this triggered yet another race condition, where not all translations
would be generated by the time the corresponding .qrc was needed. Adding
a fugly add_dependencies(mod_common po) fixes this; however we may want to
find a cleaner way to properly express deps between the language files and the
qrc.
- set(CLIENT_RCS ${CLIENT_RCS} ../data/data.qrc PARENT_SCOPE)
+ set(CLIENT_RCS ${CLIENT_RCS} ../../data/data.qrc PARENT_SCOPE)
else()
install(FILES networks.ini DESTINATION ${DATA_INSTALL_DIR}/quassel)
install(DIRECTORY stylesheets DESTINATION ${DATA_INSTALL_DIR}/quassel)
else()
install(FILES networks.ini DESTINATION ${DATA_INSTALL_DIR}/quassel)
install(DIRECTORY stylesheets DESTINATION ${DATA_INSTALL_DIR}/quassel)
endif(INSTALL_OXY)
if(EMBED_DATA)
endif(INSTALL_OXY)
if(EMBED_DATA)
- set(ICON_RCS ../icons/hicolor.qrc ../icons/oxygen.qrc)
+ set(ICON_RCS ../../icons/hicolor.qrc ../../icons/oxygen.qrc)
- set(ICON_RCS ${ICON_RCS} ../icons/oxygen_kde.qrc)
+ set(ICON_RCS ${ICON_RCS} ../../icons/oxygen_kde.qrc)
endif(INSTALL_OXY)
set(CLIENT_RCS ${CLIENT_RCS} ${ICON_RCS} PARENT_SCOPE)
else(EMBED_DATA)
endif(INSTALL_OXY)
set(CLIENT_RCS ${CLIENT_RCS} ${ICON_RCS} PARENT_SCOPE)
else(EMBED_DATA)
set(COMMON_DEPS ${COMMON_DEPS} ${CMAKE_CURRENT_BINARY_DIR}/win32.o PARENT_SCOPE)
endif(WINDRES_EXECUTABLE)
else(MINGW)
set(COMMON_DEPS ${COMMON_DEPS} ${CMAKE_CURRENT_BINARY_DIR}/win32.o PARENT_SCOPE)
endif(WINDRES_EXECUTABLE)
else(MINGW)
- set(COMMON_DEPS ${COMMON_DEPS} ../pics/win32.rc PARENT_SCOPE)
+ set(COMMON_DEPS ${COMMON_DEPS} ../../pics/win32.rc PARENT_SCOPE)
endif(MINGW)
endif(WIN32)
if(WANT_MONO OR WANT_QTCLIENT)
if(EMBED_DATA)
endif(MINGW)
endif(WIN32)
if(WANT_MONO OR WANT_QTCLIENT)
if(EMBED_DATA)
- set(CLIENT_RCS ${CLIENT_RCS} ../pics/pics.qrc PARENT_SCOPE)
+ set(CLIENT_RCS ${CLIENT_RCS} ../../pics/pics.qrc PARENT_SCOPE)
else(EMBED_DATA)
# We don't find them yet externally, so disable installation
else(EMBED_DATA)
# We don't find them yet externally, so disable installation
- set(CLIENT_RCS ${CLIENT_RCS} ../pics/pics.qrc PARENT_SCOPE)
+ set(CLIENT_RCS ${CLIENT_RCS} ../../pics/pics.qrc PARENT_SCOPE)
# install(FILES qt-logo.png
# quassel-large.png
# DESTINATION ${DATA_INSTALL_DIR}/quassel/pics)
# install(FILES qt-logo.png
# quassel-large.png
# DESTINATION ${DATA_INSTALL_DIR}/quassel/pics)
endif(EMBED_DATA)
add_custom_target(po DEPENDS ${qm_files})
endif(EMBED_DATA)
add_custom_target(po DEPENDS ${qm_files})
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) # for version.gen
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) # for version.gen
-# Add resources. Can't be done in other subdirs apparently.
-# Note that these variables need to contain paths relative to src/ (this dir)
-qt_add_resources(CLIENT_DEPS ${CLIENT_RCS})
-qt_add_resources(CORE_DEPS ${CORE_RCS})
-qt_add_resources(COMMON_DEPS ${COMMON_RCS})
- add_executable(quasselcore common/main.cpp ${COMMON_DEPS} ${CORE_DEPS})
+ add_executable(quasselcore common/main.cpp)
qt_use_modules(quasselcore Core Network ${CORE_QT_MODULES})
add_dependencies(quasselcore po)
set_target_properties(quasselcore PROPERTIES
qt_use_modules(quasselcore Core Network ${CORE_QT_MODULES})
add_dependencies(quasselcore po)
set_target_properties(quasselcore PROPERTIES
endif()
if(WANT_QTCLIENT)
endif()
if(WANT_QTCLIENT)
- add_executable(quasselclient WIN32 common/main.cpp ${COMMON_DEPS} ${CLIENT_DEPS})
+ add_executable(quasselclient WIN32 common/main.cpp)
qt_use_modules(quasselclient Core Gui Network ${CLIENT_QT_MODULES})
add_dependencies(quasselclient po)
set_target_properties(quasselclient PROPERTIES
qt_use_modules(quasselclient Core Gui Network ${CLIENT_QT_MODULES})
add_dependencies(quasselclient po)
set_target_properties(quasselclient PROPERTIES
endif(WANT_QTCLIENT)
if(WANT_MONO)
endif(WANT_QTCLIENT)
if(WANT_MONO)
- add_executable(quassel WIN32 common/main.cpp qtui/monoapplication.cpp ${COMMON_DEPS} ${CLIENT_DEPS} ${CORE_DEPS})
+ add_executable(quassel WIN32 common/main.cpp qtui/monoapplication.cpp)
qt_use_modules(quassel Core Gui Network ${CLIENT_QT_MODULES} ${CORE_QT_MODULES})
add_dependencies(quassel po)
set_target_properties(quassel PROPERTIES
qt_use_modules(quassel Core Gui Network ${CLIENT_QT_MODULES} ${CORE_QT_MODULES})
add_dependencies(quassel po)
set_target_properties(quassel PROPERTIES
list(APPEND qt_modules Widgets)
endif()
list(APPEND qt_modules Widgets)
endif()
+qt_add_resources(SOURCES ${CLIENT_RCS})
+
add_library(mod_client STATIC ${SOURCES})
qt_use_modules(mod_client Network Core Gui ${qt_modules})
add_library(mod_client STATIC ${SOURCES})
qt_use_modules(mod_client Network Core Gui ${qt_modules})
set(SOURCES ${SOURCES} logbacktrace_unix.cpp)
endif()
set(SOURCES ${SOURCES} logbacktrace_unix.cpp)
endif()
+qt_add_resources(SOURCES ${COMMON_RCS})
+
add_library(mod_common STATIC ${SOURCES})
qt_use_modules(mod_common Core Network)
add_library(mod_common STATIC ${SOURCES})
qt_use_modules(mod_common Core Network)
endif(APPLE)
target_link_libraries(mod_common ${CMAKE_DL_LIBS} ${EXECINFO_LIBRARIES} ${ZLIB_LIBRARIES})
endif(APPLE)
target_link_libraries(mod_common ${CMAKE_DL_LIBS} ${EXECINFO_LIBRARIES} ${ZLIB_LIBRARIES})
+
+# This is needed so translations are generated before trying to build the qrc.
+# Should probably find a nicer solution with proper dependencies between the involved files, though...
+add_dependencies(mod_common po)
set(CORE_RCS ${CORE_RCS} core/sql.qrc PARENT_SCOPE)
set(CORE_RCS ${CORE_RCS} core/sql.qrc PARENT_SCOPE)
+qt_add_resources(SOURCES ${CORE_RCS})
+
add_library(mod_core STATIC ${SOURCES})
qt_use_modules(mod_core Core Network Script Sql)
add_library(mod_core STATIC ${SOURCES})
qt_use_modules(mod_core Core Network Script Sql)