Files
transmission/macosx/QuickLookPlugin/CMakeLists.txt
Mike Gelfand bc380511db Modernize CMake code (ongoing refactoring) (#4507)
* Reformat CMake code

* Bump minimum CMake version to 3.12

* Add target sources separately via `target_source()`

* Make `tr_win32_app_info()` add target sources on its own

* Don't use `include_directories()`

* Don't use `add_definitions()`

* Limit use of `add_compile_options()`

* Move VDKQueue target declaration to a subdirectory

* Add `tr_disable_source_files_compile()` helper

* Add `tr_target_glib_resources()` helper

* Add `tr_gettext_msgfmt()` helper

* Enable AUTOUIC for Qt client

* Enable AUTORCC for Qt client

* Remove AUTO{MOC,RCC,UIC} source group overrides

* Add `tr_target_idl_files()` helper

* Move source group setup to `tr_qt_add_translation()`

* Add `tr_target_xib_files()` helper

* Prefer `target_sources()` to intermediate variables

* Use explicit visibility versions of `target_*()` commands

* Prefer genexes to conditions in `target_*()` commands

* Add `tr_allow_compile_if()` helper

* Leave only top-level `project()`, remove the rest

* Minor fixups

* Fixup Mac QL plugin install

* Fixup IDE target folders and source groups
2023-01-01 19:49:48 +00:00

101 lines
2.5 KiB
CMake

add_library(${TR_NAME}-mac-ql MODULE)
target_sources(${TR_NAME}-mac-ql
PRIVATE
../NSDataAdditions.mm
../NSStringAdditions.mm
GeneratePreviewForURL.mm
GenerateThumbnailForURL.mm
main.cc)
set(LINGUAS
da
de
en
es
fr
it
nl
pt_PT
ru
tr)
if(ENABLE_NLS)
set(ENABLED_LINGUAS ${LINGUAS})
else()
set(ENABLED_LINGUAS en)
endif()
set(LANG_STRINGS_FILES
Localizable.strings)
set(RESOURCES
style.css)
source_group(Resources
FILES ${RESOURCES})
set_source_files_properties(
${RESOURCES}
PROPERTIES
MACOSX_PACKAGE_LOCATION Resources)
foreach(LANG ${ENABLED_LINGUAS})
set(${LANG}_STRINGS_FILES)
set(STRINGS_FILES_RESOURCES_DIR Resources)
if(NOT CMAKE_GENERATOR STREQUAL Xcode)
string(APPEND STRINGS_FILES_RESOURCES_DIR /${LANG}.lproj)
endif()
foreach(F ${LANG_STRINGS_FILES})
list(APPEND ${LANG}_STRINGS_FILES ${LANG}.lproj/${F})
list(APPEND RESOURCES ${${LANG}_STRINGS_FILES})
set_source_files_properties(
${${LANG}_STRINGS_FILES}
PROPERTIES
MACOSX_PACKAGE_LOCATION ${STRINGS_FILES_RESOURCES_DIR})
endforeach()
source_group(Resources/${LANG}.lproj
FILES ${${LANG}_STRINGS_FILES})
endforeach()
target_sources(${TR_NAME}-mac-ql
PRIVATE
${RESOURCES})
set(MAC_QL_BUNDLE_NAME QuickLookPlugin)
set_target_properties(
${TR_NAME}-mac-ql
PROPERTIES
OUTPUT_NAME ${MAC_QL_BUNDLE_NAME}
MACOSX_BUNDLE ON
BUNDLE ON
BUNDLE_EXTENSION qlgenerator
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in"
INSTALL_RPATH "@loader_path/../../../../../MacOS;@loader_path/../../../../../Frameworks")
target_include_directories(${TR_NAME}-mac-ql
PRIVATE
${CMAKE_SOURCE_DIR}
..)
target_link_libraries(${TR_NAME}-mac-ql
PRIVATE
${TR_NAME}
"-framework Foundation"
"-framework CoreFoundation"
"-framework CoreServices"
"-framework AppKit"
"-framework QuickLook")
install(
TARGETS ${TR_NAME}-mac-ql
DESTINATION Applications/${MAC_BUNDLE_NAME}.app/Contents/Library/QuickLook)
install(CODE
"list(APPEND CMAKE_MODULE_PATH \"${CMAKE_SOURCE_DIR}/cmake\")
include(TrMacros)
include(GetPrerequisites)
tr_fixup_bundle_item(
\"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/Applications/${MAC_BUNDLE_NAME}.app\"
\"Contents/Library/QuickLook/${MAC_QL_BUNDLE_NAME}.qlgenerator/Contents/MacOS/${MAC_QL_BUNDLE_NAME}\" \"\")")