File: CMakeLists.txt

package info (click to toggle)
cmake 4.2.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 152,336 kB
  • sloc: ansic: 403,896; cpp: 303,920; sh: 4,105; python: 3,583; yacc: 3,106; lex: 1,279; f90: 538; asm: 471; lisp: 375; cs: 270; java: 266; fortran: 239; objc: 215; perl: 213; xml: 198; makefile: 111; javascript: 83; pascal: 63; tcl: 55; php: 25; ruby: 22
file content (64 lines) | stat: -rw-r--r-- 2,132 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
cmake_minimum_required(VERSION 3.10)
project(CFBundleTest)

#this is adapted from FireBreath (http://www.firebreath.org)

include(PluginConfig.cmake)

message ("Creating Mac Browser Plugin project ${PROJECT_NAME}")
set(SOURCES
    np_macmain.cpp
    Localized.r
    ${CMAKE_CURRENT_BINARY_DIR}/Info.plist
    ${CMAKE_CURRENT_BINARY_DIR}/InfoPlist.strings
    ${CMAKE_CURRENT_BINARY_DIR}/Localized.rsrc
)

add_library( ${PROJECT_NAME} MODULE
    ${SOURCES}
    )

set (RCFILES ${CMAKE_CURRENT_SOURCE_DIR}/Localized.r)

configure_file(Info.plist.in ${CMAKE_CURRENT_BINARY_DIR}/Info.plist)
configure_file(InfoPlist.strings.in ${CMAKE_CURRENT_BINARY_DIR}/InfoPlist.strings)

# Compile the resource file
find_program(RC_COMPILER Rez NO_DEFAULT_PATHS PATHS /Developer/Tools)
if(NOT RC_COMPILER)
  message(FATAL_ERROR "could not find Rez to build resources from .r file...")
endif()

set(sysroot)
if(CMAKE_OSX_SYSROOT)
  set(sysroot -isysroot ${CMAKE_OSX_SYSROOT})
endif()

execute_process(COMMAND
    ${RC_COMPILER} ${sysroot} ${RCFILES} -useDF
    -o ${CMAKE_CURRENT_BINARY_DIR}/Localized.rsrc
    )

set_source_files_properties(
    ${CMAKE_CURRENT_BINARY_DIR}/Localized.rsrc
    PROPERTIES GENERATED 1
    )
# note that for some reason, the makefile and xcode generators use a different
# property to indicate where the Info.plist file is :-/ For that reason, we
# specify it twice so it will work both places
set_target_properties(CFBundleTest PROPERTIES
    BUNDLE 1
    BUNDLE_EXTENSION plugin
    XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY ""
    XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO"
    XCODE_ATTRIBUTE_MACH_O_TYPE mh_bundle
    XCODE_ATTRIBUTE_INFOPLIST_FILE ${CMAKE_CURRENT_BINARY_DIR}/Info.plist
    MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_BINARY_DIR}/Info.plist
    LINK_FLAGS "-Wl,-exported_symbols_list,\"${CMAKE_CURRENT_SOURCE_DIR}/ExportList_plugin.txt\"")

set_source_files_properties(
    ${CMAKE_CURRENT_BINARY_DIR}/InfoPlist.strings
    ${CMAKE_CURRENT_BINARY_DIR}/Localized.rsrc
    PROPERTIES MACOSX_PACKAGE_LOCATION "Resources/English.lproj")

export(TARGETS CFBundleTest FILE ${CMAKE_CURRENT_BINARY_DIR}/exp.cmake)