# set visibility to hidden to hide symbols, unlesss they're exporeted manually in the code set(CMAKE_CXX_FLAGS "-DQT_NO_KEYWORDS -fno-exceptions") if(USE_QT5) set(QTX_INCLUDE_DIRS "") set(QTX_LIBRARIES Qt5::Widgets Qt5::X11Extras) else() set(QTX_INCLUDE_DIRS ${QT_QTCORE_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR} ${QT_QTDBUS_DIR}) set(QTX_LIBRARIES ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTDBUS_LIBRARY}) endif() include_directories( ${QTX_INCLUDE_DIRS} ${GLIB_INCLUDE_DIRS} ${OPENBOX_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR} ) set(obconf-qt_SRCS obconf-qt.cpp maindialog.cpp appearance.cpp windows.cpp mouse.cpp moveresize.cpp margins.cpp desktops.cpp dock.cpp tree.cpp archive.cpp theme.cpp fontbutton.cpp ) set(obconf-qt_UIS obconf.ui ) if(USE_QT5) qt5_wrap_ui(obconf-qt_UI_H ${obconf-qt_UIS}) else() qt4_wrap_ui(obconf-qt_UI_H ${obconf-qt_UIS}) endif() # The ui code generated by Qt uic contains QMetaObject::connectSlotsByName() # but we don't want that. Fix it with sed. add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ui_obconf_fixed.h COMMAND ${SED_PROGRAM} ARGS "/connectSlotsByName/d" ${obconf-qt_UI_H} > ${CMAKE_CURRENT_BINARY_DIR}/ui_obconf_fixed.h # DEPENDS MAIN_DEPENDENCY ${obconf-qt_UI_H} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Fixing generated ui code" VERBATIM ) # add translation for obconf-qt option (UPDATE_TRANSLATIONS "Update source translation translations/*.ts files" OFF) set(TRANSLATION_TEMPLATE "translations/obconf-qt.ts") file(GLOB TS_FILES translations/obconf-qt_*.ts) if(USE_QT5) if (UPDATE_TRANSLATIONS) qt5_create_translation(QMS_FILES ${obconf-qt_SRCS} ${obconf-qt_UI_H} ${TRANSLATION_TEMPLATE} OPTIONS -locations absolute) qt5_create_translation(QM_FILES ${obconf-qt_SRCS} ${obconf-qt_UI_H} ${TS_FILES} OPTIONS -locations absolute) else (UPDATE_TRANSLATIONS) qt5_add_translation(QM_FILES ${TS_FILES}) endif (UPDATE_TRANSLATIONS) else(USE_QT5) # use qt4 if (UPDATE_TRANSLATIONS) qt4_create_translation(QMS_FILES ${obconf-qt_SRCS} ${obconf-qt_UI_H} ${TRANSLATION_TEMPLATE} OPTIONS -locations absolute) qt4_create_translation(QMS_FILES ${obconf-qt_SRCS} ${obconf-qt_UI_H} ${TS_FILES} OPTIONS -locations absolute) else (UPDATE_TRANSLATIONS) qt4_add_translation(QM_FILES ${TS_FILES}) endif (UPDATE_TRANSLATIONS) endif(USE_QT5) if(UPDATE_TRANSLATIONS) add_custom_target(update_obconf-qt_translations ALL DEPENDS ${QMS}) endif() # install a desktop entry file include(LXQtTranslateDesktop) lxqt_translate_desktop(DESKTOP_FILES TRANSLATION_DIR "translations" SOURCES obconf-qt.desktop.in ) install(FILES ${DESKTOP_FILES} DESTINATION share/applications) install(FILES ${QM_FILES} DESTINATION share/obconf-qt/translations) # prevent the generated files from being deleted during make clean set_directory_properties(PROPERTIES CLEAN_NO_CUSTOM true) add_executable(obconf-qt ${obconf-qt_SRCS} ${obconf-qt_UI_H} ${QM_FILES} ${DESKTOP_FILES} ) add_definitions( -DPACKAGE_DATA_DIR="${CMAKE_INSTALL_PREFIX}/share/obconf-qt" -DPIXMAPS_DIR="${CMAKE_INSTALL_PREFIX}/share/pixmaps" -DTHEME_DIR="{CMAKE_INSTALL_PREFIX}/share/openbox/themes" ) target_link_libraries(obconf-qt ${QTX_LIBRARIES} ${GLIB_LIBRARIES} ${OPENBOX_LIBRARIES} ) install(TARGETS obconf-qt RUNTIME DESTINATION bin)