1 cmake_minimum_required (VERSION 2.6)
3 SET(MACOSX_BUNDLE_INFO_STRING "bundle_info_string")
4 SET(CMAKE_MacOSX_Content_COMPILE_OBJECT "\"${CMAKE_COMMAND}\" -E copy_if_different <SOURCE> <OBJECT>")
7 OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/randomResourceFile.plist"
9 ARGS "${CMAKE_CURRENT_SOURCE_DIR}/randomResourceFile.plist.in"
10 "${CMAKE_CURRENT_BINARY_DIR}/randomResourceFile.plist")
12 SET_SOURCE_FILES_PROPERTIES(
13 "${CMAKE_CURRENT_BINARY_DIR}/randomResourceFile.plist"
15 MACOSX_PACKAGE_LOCATION Resources
18 SET_SOURCE_FILES_PROPERTIES(
20 "${BundleTest_SOURCE_DIR}/../../ChangeLog.txt"
22 MACOSX_PACKAGE_LOCATION MacOS
25 SET(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}/foobar")
27 # Test building a bundle linking to a shared library where the
28 # shared library links to Carbon, but the executable does not
29 # explicitly link to Carbon, but the executable does *depend*
30 # on Carbon. There should be a link failure for the executable
31 # if CMake's dependency chaining for libraries with "-framework
32 # blah" style dependencies gets broken...
34 ADD_LIBRARY(BundleTestLib SHARED BundleLib.cxx)
35 TARGET_LINK_LIBRARIES(BundleTestLib "-framework Carbon")
37 ADD_EXECUTABLE(BundleTest
41 "${BundleTest_SOURCE_DIR}/../../ChangeLog.txt"
42 "${CMAKE_CURRENT_BINARY_DIR}/randomResourceFile.plist"
44 TARGET_LINK_LIBRARIES(BundleTest BundleTestLib)
46 # DO NOT: TARGET_LINK_LIBRARIES(BundleTest "-framework Carbon")
47 # (see above comments about Carbon)
50 # Test bundle installation.
51 #INSTALL(TARGETS BundleTestLib DESTINATION Applications/BundleTestExe.app/Contents/Plugins)
52 INSTALL(TARGETS BundleTestLib DESTINATION Applications/SecondBundleExe.app/Contents/Plugins)
53 INSTALL(TARGETS BundleTest DESTINATION Applications)
55 # Test whether bundles respect the output name. Since the library is
56 # installed into a location that uses this output name this will fail if the
57 # bundle does not respect the name. Also the executable will not be found by
58 # the test driver if this does not work.
59 SET_TARGET_PROPERTIES(BundleTest PROPERTIES OUTPUT_NAME BundleTestExe)
61 # Test executable versioning if it is supported.
63 SET_TARGET_PROPERTIES(BundleTest PROPERTIES VERSION 1)
66 # Make sure the executable can find its installed library.
67 SET_TARGET_PROPERTIES(BundleTestLib PROPERTIES
68 INSTALL_NAME_DIR "@executable_path/../Plugins")
72 # test the framework find stuff
73 IF(EXISTS /usr/lib/libtcl.dylib
74 AND EXISTS /System/Library/Frameworks/Tcl.framework)
77 MESSAGE("frame: ${TCL}")
78 IF(NOT "${TCL}" MATCHES .framework)
79 MESSAGE(FATAL_ERROR "Could not find tcl framework, found ${TCL}")
80 ENDIF(NOT "${TCL}" MATCHES .framework)
82 SET(CMAKE_FIND_FRAMEWORK LAST)
84 IF("${TCL}" MATCHES .framework)
85 MESSAGE(FATAL_ERROR "Found framework and should have found dylib ${TCL}")
86 ENDIF("${TCL}" MATCHES .framework)
88 SET(CMAKE_FIND_FRAMEWORK NEVER)
90 IF("${TCL}" MATCHES .framework)
91 MESSAGE(FATAL_ERROR "Found framework and should have found dylib ${TCL}")
92 ENDIF("${TCL}" MATCHES .framework)
93 MESSAGE("not frame: ${TCL}")
95 SET(CMAKE_FIND_FRAMEWORK FIRST)
97 IF(NOT "${TCL}" MATCHES .framework)
98 MESSAGE(FATAL_ERROR "Could not find tcl framework, found ${TCL}")
99 ENDIF(NOT "${TCL}" MATCHES .framework)
100 MESSAGE("frame: ${TCL}")
101 ENDIF(EXISTS /usr/lib/libtcl.dylib
102 AND EXISTS /System/Library/Frameworks/Tcl.framework)
104 SUBDIRS(BundleSubDir)