1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-23 16:24:02 +00:00
transmission/macosx/QuickLookPlugin/CMakeLists.txt
Mike Gelfand 43acd7e3e4
Remove Xcode project in favor of CMake (#4147)
* Compile images into an assets catalog

* Optionally sign resulting Mac bundle

* Move 3rd-party/utility/test targets to their own folders

* Enable ARC via compile options unconditionally

* Install base and localized resources into correct directory

This seems like a Xcode quirk: if subdirectory containing the resource file
matches the destination directory name (and probably if there's more than one
resource file being installed there), the resulting folder structure then
contains an extra subdirectory, i.e. Resources/dirname/dirname/resname.

* Group source files for better structure in IDEs (Xcode, VS)

* Remove Xcode project

Using Xcode is still possible via "Xcode" CMake generator.

* Use ad-hoc signature if one is not specified

* Always use ad-hoc signature on link, leave proper signing to CPack

* Install localized resources into correct directory (QL plugin)

* Don't include CTest (we don't use additional targets it provides)

* Revert "Remove Xcode project"

This reverts commit dc069f654f.
2022-11-12 20:01:57 +00:00

96 lines
2.6 KiB
CMake

project(trmacql)
set(${PROJECT_NAME}_SOURCES
../NSStringAdditions.mm
GeneratePreviewForURL.mm
GenerateThumbnailForURL.mm
main.cc
)
set(${PROJECT_NAME}_HEADERS
)
set(${PROJECT_NAME}_LINGUAS
da
de
en
es
fr
it
nl
pt_PT
ru
tr
)
if(ENABLE_NLS)
set(${PROJECT_NAME}_ENABLED_LINGUAS ${${PROJECT_NAME}_LINGUAS})
else()
set(${PROJECT_NAME}_ENABLED_LINGUAS en)
endif()
set(${PROJECT_NAME}_LANG_STRINGS_FILES
Localizable.strings
)
set(${PROJECT_NAME}_RESOURCES
style.css
)
source_group(Resources FILES ${${PROJECT_NAME}_RESOURCES})
set_source_files_properties(${${PROJECT_NAME}_RESOURCES} PROPERTIES
MACOSX_PACKAGE_LOCATION Resources)
foreach(LANG ${${PROJECT_NAME}_ENABLED_LINGUAS})
set(${PROJECT_NAME}_${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 ${${PROJECT_NAME}_LANG_STRINGS_FILES})
list(APPEND ${PROJECT_NAME}_${LANG}_STRINGS_FILES ${LANG}.lproj/${F})
list(APPEND ${PROJECT_NAME}_RESOURCES ${${PROJECT_NAME}_${LANG}_STRINGS_FILES})
set_source_files_properties(${${PROJECT_NAME}_${LANG}_STRINGS_FILES} PROPERTIES
MACOSX_PACKAGE_LOCATION ${STRINGS_FILES_RESOURCES_DIR})
endforeach()
source_group(Resources/${LANG}.lproj FILES ${${PROJECT_NAME}_${LANG}_STRINGS_FILES})
endforeach()
add_library(${TR_NAME}-mac-ql MODULE
${${PROJECT_NAME}_SOURCES}
${${PROJECT_NAME}_HEADERS}
${${PROJECT_NAME}_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 "${PROJECT_SOURCE_DIR}/Info.plist.in"
INSTALL_RPATH "@loader_path/../../../../../MacOS;@loader_path/../../../../../Frameworks"
)
target_include_directories(${TR_NAME}-mac-ql PRIVATE
..
)
target_link_libraries(${TR_NAME}-mac-ql
${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}\" \"\")
")