Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Kitware
GitHub Repository: Kitware/CMake
Path: blob/master/Tests/CFBundleTest/CMakeLists.txt
3148 views
1
cmake_minimum_required(VERSION 3.10)
2
project(CFBundleTest)
3
4
#this is adapted from FireBreath (http://www.firebreath.org)
5
6
include(PluginConfig.cmake)
7
8
message ("Creating Mac Browser Plugin project ${PROJECT_NAME}")
9
set(SOURCES
10
np_macmain.cpp
11
Localized.r
12
${CMAKE_CURRENT_BINARY_DIR}/Info.plist
13
${CMAKE_CURRENT_BINARY_DIR}/InfoPlist.strings
14
${CMAKE_CURRENT_BINARY_DIR}/Localized.rsrc
15
)
16
17
add_library( ${PROJECT_NAME} MODULE
18
${SOURCES}
19
)
20
21
set (RCFILES ${CMAKE_CURRENT_SOURCE_DIR}/Localized.r)
22
23
configure_file(Info.plist.in ${CMAKE_CURRENT_BINARY_DIR}/Info.plist)
24
configure_file(InfoPlist.strings.in ${CMAKE_CURRENT_BINARY_DIR}/InfoPlist.strings)
25
26
# Compile the resource file
27
find_program(RC_COMPILER Rez NO_DEFAULT_PATHS PATHS /Developer/Tools)
28
if(NOT RC_COMPILER)
29
message(FATAL_ERROR "could not find Rez to build resources from .r file...")
30
endif()
31
32
set(sysroot)
33
if(CMAKE_OSX_SYSROOT)
34
set(sysroot -isysroot ${CMAKE_OSX_SYSROOT})
35
endif()
36
37
execute_process(COMMAND
38
${RC_COMPILER} ${sysroot} ${RCFILES} -useDF
39
-o ${CMAKE_CURRENT_BINARY_DIR}/Localized.rsrc
40
)
41
42
set_source_files_properties(
43
${CMAKE_CURRENT_BINARY_DIR}/Localized.rsrc
44
PROPERTIES GENERATED 1
45
)
46
# note that for some reason, the makefile and xcode generators use a different
47
# property to indicate where the Info.plist file is :-/ For that reason, we
48
# specify it twice so it will work both places
49
set_target_properties(CFBundleTest PROPERTIES
50
BUNDLE 1
51
BUNDLE_EXTENSION plugin
52
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY ""
53
XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO"
54
XCODE_ATTRIBUTE_MACH_O_TYPE mh_bundle
55
XCODE_ATTRIBUTE_INFOPLIST_FILE ${CMAKE_CURRENT_BINARY_DIR}/Info.plist
56
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_BINARY_DIR}/Info.plist
57
LINK_FLAGS "-Wl,-exported_symbols_list,\"${CMAKE_CURRENT_SOURCE_DIR}/ExportList_plugin.txt\"")
58
59
set_source_files_properties(
60
${CMAKE_CURRENT_BINARY_DIR}/InfoPlist.strings
61
${CMAKE_CURRENT_BINARY_DIR}/Localized.rsrc
62
PROPERTIES MACOSX_PACKAGE_LOCATION "Resources/English.lproj")
63
64
export(TARGETS CFBundleTest FILE ${CMAKE_CURRENT_BINARY_DIR}/exp.cmake)
65
66