summaryrefslogtreecommitdiffstats
path: root/Tests/BundleGeneratorTest
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2008-07-30 20:36:22 (GMT)
committerDavid Cole <david.cole@kitware.com>2008-07-30 20:36:22 (GMT)
commit6ec7ec20792c5a83bad99066447965baad59b831 (patch)
tree97fdf0e11091c9b71a2f06eb06c46c0afcd1ba1e /Tests/BundleGeneratorTest
parentbab77e53e3aef9c07fe488e73be8dc7d60aaa4fc (diff)
downloadCMake-6ec7ec20792c5a83bad99066447965baad59b831.zip
CMake-6ec7ec20792c5a83bad99066447965baad59b831.tar.gz
CMake-6ec7ec20792c5a83bad99066447965baad59b831.tar.bz2
ENH: Add test for the new CPack BundleGenerator. Thanks to Tim Shead for the patch. See issue #7170 for more details.
Diffstat (limited to 'Tests/BundleGeneratorTest')
-rw-r--r--Tests/BundleGeneratorTest/BundleIcon.icnsbin0 -> 33452 bytes
-rw-r--r--Tests/BundleGeneratorTest/CMakeLists.txt24
-rw-r--r--Tests/BundleGeneratorTest/Executable.cxx8
-rw-r--r--Tests/BundleGeneratorTest/Info.plist14
-rw-r--r--Tests/BundleGeneratorTest/Library.cxx7
-rwxr-xr-xTests/BundleGeneratorTest/StartupCommand12
6 files changed, 65 insertions, 0 deletions
diff --git a/Tests/BundleGeneratorTest/BundleIcon.icns b/Tests/BundleGeneratorTest/BundleIcon.icns
new file mode 100644
index 0000000..8808dd6
--- /dev/null
+++ b/Tests/BundleGeneratorTest/BundleIcon.icns
Binary files differ
diff --git a/Tests/BundleGeneratorTest/CMakeLists.txt b/Tests/BundleGeneratorTest/CMakeLists.txt
new file mode 100644
index 0000000..e671d40
--- /dev/null
+++ b/Tests/BundleGeneratorTest/CMakeLists.txt
@@ -0,0 +1,24 @@
+PROJECT(BundleGeneratorTest)
+
+CMAKE_MINIMUM_REQUIRED(VERSION 2.7)
+
+# Build a shared library and install it in lib/
+ADD_LIBRARY(Library SHARED Library.cxx)
+INSTALL(TARGETS Library DESTINATION lib)
+
+# Build an executable and install it in bin/
+ADD_EXECUTABLE(Executable Executable.cxx)
+TARGET_LINK_LIBRARIES(Executable Library)
+INSTALL(TARGETS Executable DESTINATION bin)
+
+# Use the bundle-generator for packaging ...
+SET(CPACK_GENERATOR "Bundle")
+SET(CPACK_BUNDLE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/BundleIcon.icns")
+SET(CPACK_BUNDLE_NAME "BundleGeneratorTest")
+SET(CPACK_BUNDLE_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.plist")
+SET(CPACK_BUNDLE_STARTUP_COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/StartupCommand")
+SET(CPACK_PACKAGE_DESCRIPTION "Project for testing OSX bundle generation")
+SET(CPACK_PACKAGE_NAME "BundleGeneratorTest")
+SET(CPACK_PACKAGE_VERSION "0.1")
+INCLUDE(CPack)
+
diff --git a/Tests/BundleGeneratorTest/Executable.cxx b/Tests/BundleGeneratorTest/Executable.cxx
new file mode 100644
index 0000000..8107f78
--- /dev/null
+++ b/Tests/BundleGeneratorTest/Executable.cxx
@@ -0,0 +1,8 @@
+extern void print_message(const char* const Message);
+
+int main(int argc, char* argv[])
+{
+ print_message("Howdy, World!\n");
+ return 0;
+}
+
diff --git a/Tests/BundleGeneratorTest/Info.plist b/Tests/BundleGeneratorTest/Info.plist
new file mode 100644
index 0000000..e5a7d00
--- /dev/null
+++ b/Tests/BundleGeneratorTest/Info.plist
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+ <dict>
+ <key>CFBundleExecutable</key>
+ <string>BundleGeneratorTest</string>
+ <key>CFBundleIconFile</key>
+ <string>BundleGeneratorTest.icns</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ </dict>
+</plist>
diff --git a/Tests/BundleGeneratorTest/Library.cxx b/Tests/BundleGeneratorTest/Library.cxx
new file mode 100644
index 0000000..1403c68
--- /dev/null
+++ b/Tests/BundleGeneratorTest/Library.cxx
@@ -0,0 +1,7 @@
+#include <iostream>
+
+void print_message(const char* const Message)
+{
+ std::cout << Message;
+}
+
diff --git a/Tests/BundleGeneratorTest/StartupCommand b/Tests/BundleGeneratorTest/StartupCommand
new file mode 100755
index 0000000..5bc5ad2
--- /dev/null
+++ b/Tests/BundleGeneratorTest/StartupCommand
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+BUNDLE="`echo "$0" | sed -e 's/\/Contents\/MacOS\/.*//'`"
+RESOURCES="$BUNDLE/Contents/Resources"
+
+echo "BUNDLE: $BUNDLE"
+echo "RESOURCES: $RESOURCES"
+
+export DYLD_LIBRARY_PATH=$RESOURCES/lib
+
+exec "$RESOURCES/bin/Executable"
+