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.
 
 
 
 
dp4-uos/dp4-login-plugin/CMakeLists.txt

44 lines
1.1 KiB

cmake_minimum_required(VERSION 3.7)
set(LIB_NAME "dp4-login-plugin")
project(${LIB_NAME})
include(GNUInstallDirs)
# 启用 qt moc 的支持
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
file(GLOB_RECURSE SRCS "*.h" "*.cpp")
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
ADD_DEFINITIONS(-DQM_FILES_DIR="${CMAKE_BINARY_DIR}/${LIB_NAME}")
else()
ADD_DEFINITIONS(-DQM_FILES_DIR="/usr/share/${LIB_NAME}/translations")
endif()
find_package(Qt5 COMPONENTS Core Widgets DBus Network LinguistTools REQUIRED)
find_package(PkgConfig REQUIRED)
find_package(DdeSessionShell REQUIRED)
file(GLOB TS_FILES "translations/*.ts")
qt5_add_translation(QM_FILES ${TS_FILES})
add_custom_target(${LIB_NAME}_language ALL DEPENDS ${QM_FILES})
add_library(${LIB_NAME} SHARED ${SRCS})
target_include_directories(${LIB_NAME} PUBLIC
Qt5::Core
Qt5::DBus
${DDESESSIONSHELL_INCLUDE_DIR}
)
target_link_libraries(${LIB_NAME} PRIVATE
Qt5::Core
Qt5::DBus
${Qt5Widgets_LIBRARIES}
)
install(TARGETS ${LIB_NAME} LIBRARY DESTINATION lib/dde-session-shell/modules)# 安装.qm文件
install(FILES ${QM_FILES} DESTINATION ${CMAKE_INSTALL_DATADIR}/${LIB_NAME}/translations/)