2008-03-25 18:27:18 +03:00
|
|
|
cmake_minimum_required (VERSION 2.6)
|
2005-07-13 23:43:40 +04:00
|
|
|
PROJECT(BundleTest)
|
|
|
|
SET(MACOSX_BUNDLE_INFO_STRING "bundle_info_string")
|
2006-03-28 17:54:01 +04:00
|
|
|
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
|
2008-08-27 20:53:19 +04:00
|
|
|
"${BundleTest_SOURCE_DIR}/../../ChangeLog.txt"
|
2006-03-28 17:54:01 +04:00
|
|
|
PROPERTIES
|
|
|
|
MACOSX_PACKAGE_LOCATION MacOS
|
|
|
|
)
|
|
|
|
|
|
|
|
SET(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}/foobar")
|
2006-03-03 20:58:48 +03:00
|
|
|
|
2008-09-02 19:07:04 +04:00
|
|
|
# Test building a bundle linking to a shared library where the
|
2010-08-18 00:11:33 +04:00
|
|
|
# shared library links to CoreFoundation, but the executable does not
|
|
|
|
# explicitly link to CoreFoundation, but the executable does *depend*
|
|
|
|
# on CoreFoundation. There should be a link failure for the executable
|
2008-09-02 19:07:04 +04:00
|
|
|
# if CMake's dependency chaining for libraries with "-framework
|
|
|
|
# blah" style dependencies gets broken...
|
|
|
|
#
|
2006-03-03 20:58:48 +03:00
|
|
|
ADD_LIBRARY(BundleTestLib SHARED BundleLib.cxx)
|
2010-08-18 00:11:33 +04:00
|
|
|
TARGET_LINK_LIBRARIES(BundleTestLib "-framework CoreFoundation")
|
2008-09-02 19:07:04 +04:00
|
|
|
|
2006-03-28 17:54:01 +04:00
|
|
|
ADD_EXECUTABLE(BundleTest
|
|
|
|
MACOSX_BUNDLE
|
|
|
|
BundleTest.cxx
|
|
|
|
SomeRandomFile.txt
|
2008-08-27 20:53:19 +04:00
|
|
|
"${BundleTest_SOURCE_DIR}/../../ChangeLog.txt"
|
2006-03-28 17:54:01 +04:00
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/randomResourceFile.plist"
|
|
|
|
)
|
2006-03-03 20:58:48 +03:00
|
|
|
TARGET_LINK_LIBRARIES(BundleTest BundleTestLib)
|
2008-09-02 19:07:04 +04:00
|
|
|
#
|
2010-08-18 00:11:33 +04:00
|
|
|
# DO NOT: TARGET_LINK_LIBRARIES(BundleTest "-framework CoreFoundation")
|
|
|
|
# (see above comments about CoreFoundation)
|
2008-09-02 19:07:04 +04:00
|
|
|
#
|
2006-03-03 20:58:48 +03:00
|
|
|
|
|
|
|
# Test bundle installation.
|
2007-08-24 21:30:41 +04:00
|
|
|
#INSTALL(TARGETS BundleTestLib DESTINATION Applications/BundleTestExe.app/Contents/Plugins)
|
|
|
|
INSTALL(TARGETS BundleTestLib DESTINATION Applications/SecondBundleExe.app/Contents/Plugins)
|
|
|
|
INSTALL(TARGETS BundleTest DESTINATION Applications)
|
2006-03-03 20:58:48 +03:00
|
|
|
|
|
|
|
# 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)
|
2005-07-13 23:43:40 +04:00
|
|
|
|
2006-03-03 20:58:48 +03:00
|
|
|
# Make sure the executable can find its installed library.
|
|
|
|
SET_TARGET_PROPERTIES(BundleTestLib PROPERTIES
|
|
|
|
INSTALL_NAME_DIR "@executable_path/../Plugins")
|
2006-03-10 18:12:26 +03:00
|
|
|
|
|
|
|
INCLUDE(CPack)
|
|
|
|
|
2006-03-29 22:33:49 +04:00
|
|
|
# test the framework find stuff
|
|
|
|
IF(EXISTS /usr/lib/libtcl.dylib
|
2007-08-24 21:30:41 +04:00
|
|
|
AND EXISTS /System/Library/Frameworks/Tcl.framework)
|
2006-03-29 22:33:49 +04:00
|
|
|
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
|
2007-08-24 21:30:41 +04:00
|
|
|
AND EXISTS /System/Library/Frameworks/Tcl.framework)
|
2006-07-07 00:05:54 +04:00
|
|
|
|
|
|
|
SUBDIRS(BundleSubDir)
|