blob: ff9626f1b8cb88e009d9283983b016fc91a331bc (
plain)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
PROJECT(BundleTest)
SET(MACOSX_BUNDLE_INFO_STRING "bundle_info_string")
SET(CMAKE_MacOSX_Content_COMPILE_OBJECT "\"${CMAKE_COMMAND}\" -E copy_if_different <SOURCE> <OBJECT>")
ADD_CUSTOM_COMMAND(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/randomResourceFile.plist"
COMMAND /bin/cp
ARGS "${CMAKE_CURRENT_SOURCE_DIR}/randomResourceFile.plist.in"
"${CMAKE_CURRENT_BINARY_DIR}/randomResourceFile.plist")
SET_SOURCE_FILES_PROPERTIES(
"${CMAKE_CURRENT_BINARY_DIR}/randomResourceFile.plist"
PROPERTIES
MACOSX_PACKAGE_LOCATION Resources
)
SET_SOURCE_FILES_PROPERTIES(
SomeRandomFile.txt
"${CMake_SOURCE_DIR}/ChangeLog.txt"
PROPERTIES
MACOSX_PACKAGE_LOCATION MacOS
)
SET(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}/foobar")
# Test building a bundle linking to a shared library.
ADD_LIBRARY(BundleTestLib SHARED BundleLib.cxx)
ADD_EXECUTABLE(BundleTest
MACOSX_BUNDLE
BundleTest.cxx
SomeRandomFile.txt
"${CMake_SOURCE_DIR}/ChangeLog.txt"
"${CMAKE_CURRENT_BINARY_DIR}/randomResourceFile.plist"
)
TARGET_LINK_LIBRARIES(BundleTest BundleTestLib)
# Test bundle installation.
#INSTALL(TARGETS BundleTestLib DESTINATION Application/BundleTestExe.app/Contents/Plugins)
INSTALL(TARGETS BundleTestLib DESTINATION Application/SecondBundleExe.app/Contents/Plugins)
INSTALL(TARGETS BundleTest DESTINATION Application)
# Test whether bundles respect the output name. Since the library is
# installed into a location that uses this output name this will fail if the
# bundle does not respect the name. Also the executable will not be found by
# the test driver if this does not work.
SET_TARGET_PROPERTIES(BundleTest PROPERTIES OUTPUT_NAME BundleTestExe)
# Test executable versioning if it is supported.
IF(NOT XCODE)
SET_TARGET_PROPERTIES(BundleTest PROPERTIES VERSION 1)
ENDIF(NOT XCODE)
# Make sure the executable can find its installed library.
SET_TARGET_PROPERTIES(BundleTestLib PROPERTIES
INSTALL_NAME_DIR "@executable_path/../Plugins")
INCLUDE(CPack)
# test the framework find stuff
IF(EXISTS /usr/lib/libtcl.dylib
AND EXISTS /System/Library/Frameworks/tcl.framework)
SET(TCL NOTFOUND)
FIND_LIBRARY(TCL tcl)
MESSAGE("frame: ${TCL}")
IF(NOT "${TCL}" MATCHES .framework)
MESSAGE(FATAL_ERROR "Could not find tcl framework, found ${TCL}")
ENDIF(NOT "${TCL}" MATCHES .framework)
SET(TCL NOTFOUND)
SET(CMAKE_FIND_FRAMEWORK LAST)
FIND_LIBRARY(TCL tcl)
IF("${TCL}" MATCHES .framework)
MESSAGE(FATAL_ERROR "Found framework and should have found dylib ${TCL}")
ENDIF("${TCL}" MATCHES .framework)
SET(TCL NOTFOUND)
SET(CMAKE_FIND_FRAMEWORK NEVER)
FIND_LIBRARY(TCL tcl)
IF("${TCL}" MATCHES .framework)
MESSAGE(FATAL_ERROR "Found framework and should have found dylib ${TCL}")
ENDIF("${TCL}" MATCHES .framework)
MESSAGE("not frame: ${TCL}")
SET(TCL NOTFOUND)
SET(CMAKE_FIND_FRAMEWORK FIRST)
FIND_LIBRARY(TCL tcl)
IF(NOT "${TCL}" MATCHES .framework)
MESSAGE(FATAL_ERROR "Could not find tcl framework, found ${TCL}")
ENDIF(NOT "${TCL}" MATCHES .framework)
MESSAGE("frame: ${TCL}")
ENDIF(EXISTS /usr/lib/libtcl.dylib
AND EXISTS /System/Library/Frameworks/tcl.framework)
SUBDIRS(BundleSubDir)
|