You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lxqt-globalkeys-packaging/ui/CMakeLists.txt

162 lines
5.3 KiB

set(PROJECT_NAME ${LXQT_GLOBALKEYS_UI_LIBRARY_NAME})
project(${PROJECT_NAME})
set(QT_DBUS_PREFIX "org.qtproject")
set(LXQT_GLOBALKEYS_LIBRARY lxqt-globalkeys)
set(${PROJECT_NAME}_HEADER_NAMESPACE "LXQtGlobalKeysUi")
include_directories(
"${PROJECT_SOURCE_DIR}"
"${CMAKE_CURRENT_BINARY_DIR}"
${LXQT_INCLUDE_DIRS}
)
add_definitions(-DSHARED_EXPORT=Q_DECL_EXPORT)
set(${PROJECT_NAME}_SOURCES
shortcut_selector.cpp
)
set(${PROJECT_NAME}_MAIN_HEADER
)
#
# WARNING: Changing stuff here implies changing this:
#install(FILES ${${PROJECT_NAME}_PUBLIC_HEADERS} DESTINATION include/${PROJECT_NAME} COMPONENT development RENAME "shortcutselector.h")
#
set(${PROJECT_NAME}_PUBLIC_CPP_HEADERS
shortcut_selector.h
)
set(${PROJECT_NAME}_PUBLIC_CLASSES
ShortcutSelector
)
set(${PROJECT_NAME}_PRIVATE_CPP_HEADERS
)
set(${PROJECT_NAME}_FORMS
)
set(${PROJECT_NAME}_RESOURCES
)
set(${PROJECT_NAME}_TRANSLATIONS
)
set(${PROJECT_NAME}_DBUS_ADAPTORS
)
set(${PROJECT_NAME}_DBUS_INTERFACES
)
set(${PROJECT_NAME}_PUBLIC_HEADERS
${${PROJECT_NAME}_PUBLIC_CPP_HEADERS}
)
set(${PROJECT_NAME}_PRIVATE_HEADERS
${${PROJECT_NAME}_PRIVATE_CPP_HEADERS}
)
set(${PROJECT_NAME}_CPP_HEADERS
${${PROJECT_NAME}_PUBLIC_CPP_HEADERS}
${${PROJECT_NAME}_PRIVATE_CPP_HEADERS}
)
set(${PROJECT_NAME}_HEADERS
${${PROJECT_NAME}_PUBLIC_HEADERS}
${${PROJECT_NAME}_PRIVATE_HEADERS}
)
set(${PROJECT_NAME}_TRANSLATABLE
${${PROJECT_NAME}_SOURCES}
${${PROJECT_NAME}_HEADERS}
${${PROJECT_NAME}_FORMS}
)
foreach(DBUS_ADAPTOR ${${PROJECT_NAME}_DBUS_ADAPTORS})
get_filename_component(DBUS_ADAPTOR_FILENAME ${DBUS_ADAPTOR} NAME)
configure_file(
${DBUS_ADAPTOR}
"${CMAKE_CURRENT_BINARY_DIR}/${DBUS_ADAPTOR_FILENAME}"
@ONLY
)
get_source_file_property(DBUS_ADAPTOR_INCLUDE ${DBUS_ADAPTOR} INCLUDE)
get_source_file_property(DBUS_ADAPTOR_PARENT_CLASSNAME ${DBUS_ADAPTOR} PARENT_CLASSNAME)
get_source_file_property(DBUS_ADAPTOR_BASENAME ${DBUS_ADAPTOR} BASENAME)
get_source_file_property(DBUS_ADAPTOR_CLASSNAME ${DBUS_ADAPTOR} CLASSNAME)
if(DBUS_ADAPTOR_BASENAME)
if(DBUS_ADAPTOR_CLASSNAME)
qt5_add_dbus_adaptor(${PROJECT_NAME}_DBUS_ADAPTOR_FILES "${CMAKE_CURRENT_BINARY_DIR}/${DBUS_ADAPTOR_FILENAME}" ${DBUS_ADAPTOR_INCLUDE} ${DBUS_ADAPTOR_PARENT_CLASSNAME} ${DBUS_ADAPTOR_BASENAME} ${DBUS_ADAPTOR_CLASSNAME})
else()
qt5_add_dbus_adaptor(${PROJECT_NAME}_DBUS_ADAPTOR_FILES "${CMAKE_CURRENT_BINARY_DIR}/${DBUS_ADAPTOR_FILENAME}" ${DBUS_ADAPTOR_INCLUDE} ${DBUS_ADAPTOR_PARENT_CLASSNAME} ${DBUS_ADAPTOR_BASENAME})
endif()
else()
qt5_add_dbus_adaptor(${PROJECT_NAME}_DBUS_ADAPTOR_FILES "${CMAKE_CURRENT_BINARY_DIR}/${DBUS_ADAPTOR_FILENAME}" ${DBUS_ADAPTOR_INCLUDE} ${DBUS_ADAPTOR_PARENT_CLASSNAME})
endif()
endforeach()
foreach(DBUS_INTERFACE ${${PROJECT_NAME}_DBUS_INTERFACES})
get_filename_component(DBUS_INTERFACE_FILENAME ${DBUS_INTERFACE} NAME)
configure_file(
${DBUS_INTERFACE}
${CMAKE_CURRENT_BINARY_DIR}/${DBUS_INTERFACE_FILENAME}
@ONLY
)
get_source_file_property(DBUS_INTERFACE_BASENAME ${DBUS_INTERFACE} BASENAME)
get_source_file_property(DBUS_INTERFACE_INCLUDE ${DBUS_INTERFACE} INCLUDE)
get_source_file_property(DBUS_INTERFACE_CLASSNAME ${DBUS_INTERFACE} CLASSNAME)
get_source_file_property(DBUS_INTERFACE_NO_NAMESPACE ${DBUS_INTERFACE} NO_NAMESPACE)
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${DBUS_INTERFACE_FILENAME} PROPERTIES
INCLUDE ${DBUS_INTERFACE_INCLUDE}
CLASSNAME ${DBUS_INTERFACE_CLASSNAME}
NO_NAMESPACE ${DBUS_INTERFACE_NO_NAMESPACE}
)
qt5_add_dbus_interface(${PROJECT_NAME}_DBUS_INTERFACE_FILES ${CMAKE_CURRENT_BINARY_DIR}/${DBUS_INTERFACE_FILENAME} ${DBUS_INTERFACE_BASENAME})
endforeach()
qt5_add_resources(${PROJECT_NAME}_RESOURCE_FILES ${${PROJECT_NAME}_RESOURCES})
qt5_wrap_ui(${PROJECT_NAME}_FORM_FILES ${${PROJECT_NAME}_FORMS})
set(${PROJECT_NAME}_GENERATED_FILES
${${PROJECT_NAME}_FORM_FILES}
${${PROJECT_NAME}_RESOURCE_FILES}
${${PROJECT_NAME}_QM_FILES}
${${PROJECT_NAME}_DBUS_INTERFACE_FILES}
${${PROJECT_NAME}_DBUS_ADAPTOR_FILES}
)
set(${PROJECT_NAME}_ALL_FILES
${${PROJECT_NAME}_SOURCES}
${${PROJECT_NAME}_HEADERS}
${${PROJECT_NAME}_GENERATED_FILES}
)
add_library(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_ALL_FILES})
target_link_libraries(${PROJECT_NAME}
Qt5::Widgets
Qt5::DBus
${LXQT_GLOBALKEYS_LIBRARY}
)
set_target_properties(${PROJECT_NAME}
PROPERTIES
VERSION ${LXQT_VERSION}
SOVERSION ${LXQT_MAJOR_VERSION}
)
include(create_portable_headers)
create_portable_headers(${PROJECT_NAME}_PORTABLE_HEADERS
NAMESPACE "${${PROJECT_NAME}_HEADER_NAMESPACE}/"
FILENAMES ${${PROJECT_NAME}_PUBLIC_CLASSES}
)
install(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR} COMPONENT runtime)
install(FILES ${${PROJECT_NAME}_PUBLIC_HEADERS} DESTINATION include/${PROJECT_NAME} COMPONENT development)
install(FILES ${${PROJECT_NAME}_PUBLIC_HEADERS} DESTINATION include/${PROJECT_NAME} COMPONENT development RENAME "shortcutselector.h")
install(FILES ${${PROJECT_NAME}_PORTABLE_HEADERS} DESTINATION include/${PROJECT_NAME}/${${PROJECT_NAME}_HEADER_NAMESPACE} COMPONENT development)
include(create_pkgconfig_file)
create_pkgconfig_file(${PROJECT_NAME} "LXQt global key shortcuts GUI support library")