ENH: Add test for the new CPack BundleGenerator. Thanks to Tim Shead for the patch. See issue #7170 for more details.

This commit is contained in:
David Cole 2008-07-30 16:36:22 -04:00
parent bab77e53e3
commit 6ec7ec2079
7 changed files with 78 additions and 0 deletions

Binary file not shown.

View File

@ -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)

View File

@ -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;
}

View File

@ -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>

View File

@ -0,0 +1,7 @@
#include <iostream>
void print_message(const char* const Message)
{
std::cout << Message;
}

View File

@ -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"

View File

@ -709,6 +709,19 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=CVS -P ${CMake_SOURCE_DIR}/Utilities/Rel
ADD_TEST_MACRO(ObjC++ ObjC++)
ENDIF (APPLE AND CMAKE_COMPILER_IS_GNUCXX)
IF(APPLE AND CTEST_TEST_CPACK)
ADD_TEST(BundleGeneratorTest ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/BundleGeneratorTest"
"${CMake_BINARY_DIR}/Tests/BundleGeneratorTest"
--build-two-config
--build-generator ${CMAKE_TEST_GENERATOR}
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
--build-target package
--build-options "-DCMAKE_INSTALL_PREFIX:PATH=${CMake_BINARY_DIR}/Tests/BundleGeneratorTest/InstallDirectory"
)
ENDIF(APPLE AND CTEST_TEST_CPACK)
IF (CTEST_TEST_CTEST AND CMAKE_RUN_LONG_TESTS)
CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestTest/test.cmake.in"
"${CMake_BINARY_DIR}/Tests/CTestTest/test.cmake" @ONLY ESCAPE_QUOTES)