59 lines
1.8 KiB
CMake
59 lines
1.8 KiB
CMake
# qwfassoc: shared library exporting reusable Qt widgets that wrap wfassoc.
|
|
|
|
# Qt 6 requires C++17 at minimum.
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
set(QWFASSOC_SOURCES
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/src/application_widget.cpp"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/src/association_widget.cpp"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/src/icon_utils.cpp"
|
|
)
|
|
|
|
set(QWFASSOC_HEADERS
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/src/qwfassoc_global.h"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/src/scope.h"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/src/manifest.h"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/src/application_widget.h"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/src/association_widget.h"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/src/icon_utils.h"
|
|
)
|
|
|
|
set(QWFASSOC_UI
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/src/application_widget.ui"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/src/association_widget.ui"
|
|
)
|
|
|
|
add_library(qwfassoc SHARED
|
|
${QWFASSOC_SOURCES}
|
|
${QWFASSOC_HEADERS}
|
|
${QWFASSOC_UI}
|
|
)
|
|
|
|
# QWFASSOC_LIBRARY switches QWFASSOC_EXPORT from import to export mode.
|
|
target_compile_definitions(qwfassoc PRIVATE QWFASSOC_LIBRARY)
|
|
|
|
# Consumers (and the library itself) need to find the public headers under
|
|
# src/. PUBLIC propagates the include path to anyone linking against qwfassoc.
|
|
target_include_directories(qwfassoc PUBLIC
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/src"
|
|
)
|
|
|
|
target_link_libraries(qwfassoc PUBLIC
|
|
Qt6::Widgets
|
|
wfassoc::wfassoc
|
|
)
|
|
|
|
# Translation pipeline for the library. qt6_add_translations() runs lupdate
|
|
# against the target's sources and embeds the lrelease output under the
|
|
# ":/i18n" resource prefix, where installTranslators() in the executable
|
|
# looks it up at runtime.
|
|
set(QWFASSOC_TS_FILES
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/i18n/qwfassoc_zh_CN.ts"
|
|
)
|
|
|
|
qt6_add_translations(qwfassoc
|
|
TS_FILES ${QWFASSOC_TS_FILES}
|
|
)
|