2
2
SET(MACOSX_BUNDLE_INFO_STRING "bundle_info_string")
3
ADD_EXECUTABLE(BundleTest MACOSX_BUNDLE BundleTest.cxx)
3
SET(CMAKE_MacOSX_Content_COMPILE_OBJECT "\"${CMAKE_COMMAND}\" -E copy_if_different <SOURCE> <OBJECT>")
6
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/randomResourceFile.plist"
8
ARGS "${CMAKE_CURRENT_SOURCE_DIR}/randomResourceFile.plist.in"
9
"${CMAKE_CURRENT_BINARY_DIR}/randomResourceFile.plist")
11
SET_SOURCE_FILES_PROPERTIES(
12
"${CMAKE_CURRENT_BINARY_DIR}/randomResourceFile.plist"
14
MACOSX_PACKAGE_LOCATION Resources
17
SET_SOURCE_FILES_PROPERTIES(
20
MACOSX_PACKAGE_LOCATION MacOS
23
SET(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}/foobar")
25
# Test building a bundle linking to a shared library.
26
ADD_LIBRARY(BundleTestLib SHARED BundleLib.cxx)
27
ADD_EXECUTABLE(BundleTest
31
"${CMAKE_CURRENT_BINARY_DIR}/randomResourceFile.plist"
34
TARGET_LINK_LIBRARIES(BundleTest BundleTestLib)
36
# Test bundle installation.
37
INSTALL(TARGETS BundleTestLib DESTINATION Application/BundleTestExe.app/Contents/Plugins)
38
INSTALL(TARGETS BundleTest DESTINATION Application)
40
# Test whether bundles respect the output name. Since the library is
41
# installed into a location that uses this output name this will fail if the
42
# bundle does not respect the name. Also the executable will not be found by
43
# the test driver if this does not work.
44
SET_TARGET_PROPERTIES(BundleTest PROPERTIES OUTPUT_NAME BundleTestExe)
46
# Test executable versioning if it is supported.
48
SET_TARGET_PROPERTIES(BundleTest PROPERTIES VERSION 1)
51
# Make sure the executable can find its installed library.
52
SET_TARGET_PROPERTIES(BundleTestLib PROPERTIES
53
INSTALL_NAME_DIR "@executable_path/../Plugins")
57
# test the framework find stuff
58
IF(EXISTS /usr/lib/libtcl.dylib
59
AND EXISTS /System/Library/Frameworks/tcl.framework)
62
MESSAGE("frame: ${TCL}")
63
IF(NOT "${TCL}" MATCHES .framework)
64
MESSAGE(FATAL_ERROR "Could not find tcl framework, found ${TCL}")
65
ENDIF(NOT "${TCL}" MATCHES .framework)
67
SET(CMAKE_FIND_FRAMEWORK LAST)
69
IF("${TCL}" MATCHES .framework)
70
MESSAGE(FATAL_ERROR "Found framework and should have found dylib ${TCL}")
71
ENDIF("${TCL}" MATCHES .framework)
73
SET(CMAKE_FIND_FRAMEWORK NEVER)
75
IF("${TCL}" MATCHES .framework)
76
MESSAGE(FATAL_ERROR "Found framework and should have found dylib ${TCL}")
77
ENDIF("${TCL}" MATCHES .framework)
78
MESSAGE("not frame: ${TCL}")
80
SET(CMAKE_FIND_FRAMEWORK FIRST)
82
IF(NOT "${TCL}" MATCHES .framework)
83
MESSAGE(FATAL_ERROR "Could not find tcl framework, found ${TCL}")
84
ENDIF(NOT "${TCL}" MATCHES .framework)
85
MESSAGE("frame: ${TCL}")
86
ENDIF(EXISTS /usr/lib/libtcl.dylib
87
AND EXISTS /System/Library/Frameworks/tcl.framework)