summaryrefslogtreecommitdiffstats
path: root/Tests/BundleUtilities/bundleutils.cmake
diff options
context:
space:
mode:
authorClinton Stimpson <clinton@elemtech.com>2011-05-26 21:16:58 (GMT)
committerDavid Cole <david.cole@kitware.com>2011-05-27 20:11:43 (GMT)
commit7ac7b437b8bfc344e0d7e451d419596ea809d439 (patch)
treee1e52805a1958a8a4ff5b09a2e341fed05660a8e /Tests/BundleUtilities/bundleutils.cmake
parentba6579f7a3a687a42572f683441f56cbc70ae928 (diff)
downloadCMake-7ac7b437b8bfc344e0d7e451d419596ea809d439.zip
CMake-7ac7b437b8bfc344e0d7e451d419596ea809d439.tar.gz
CMake-7ac7b437b8bfc344e0d7e451d419596ea809d439.tar.bz2
BundleUtilities: Work w/ non .app exes on Mac (#12034)
Also add a test of BundleUtilities including an exe, some shared libs, a plugin, and a framework-style lib. This test presently runs (and this functionality works) on Linux, Mac and Windows. For now, the framework-style lib is built as a plain old shared lib because there is another yet-unresolved issue with local frameworks without rpaths on the Mac.
Diffstat (limited to 'Tests/BundleUtilities/bundleutils.cmake')
-rw-r--r--Tests/BundleUtilities/bundleutils.cmake44
1 files changed, 44 insertions, 0 deletions
diff --git a/Tests/BundleUtilities/bundleutils.cmake b/Tests/BundleUtilities/bundleutils.cmake
new file mode 100644
index 0000000..4a42a3a
--- /dev/null
+++ b/Tests/BundleUtilities/bundleutils.cmake
@@ -0,0 +1,44 @@
+
+# clean passed in arguments
+get_filename_component(INPUT ${INPUT} ABSOLUTE)
+get_filename_component(INPUTDIR ${INPUTDIR} ABSOLUTE)
+
+message("INPUT = ${INPUT}")
+message("MODULE = ${MODULE}")
+message("INPUTDIR = ${INPUTDIR}")
+message("OUTPUTDIR = ${OUTPUTDIR}")
+
+# compute location to install/test things
+file(RELATIVE_PATH relative_exe "${INPUTDIR}" "${INPUT}")
+set(OUTPUT "${OUTPUTDIR}/${relative_exe}")
+message("OUTPUT = ${OUTPUT}")
+get_filename_component(EXE_DIR "${OUTPUT}" PATH)
+get_filename_component(MODULE_NAME "${MODULE}" NAME)
+set(OUTPUT_MODULE "${EXE_DIR}/${MODULE_NAME}")
+message("OUTPUTMODULE = ${OUTPUT_MODULE}")
+
+# clean output dir
+file(REMOVE_RECURSE "${OUTPUTDIR}")
+# copy the app and plugin to installation/testing directory
+configure_file("${INPUT}" "${OUTPUT}" COPYONLY)
+configure_file("${MODULE}" "${OUTPUT_MODULE}" COPYONLY)
+
+# have BundleUtilities grab all dependencies and
+# check that the app runs
+
+# for this test we'll override location to put all dependencies
+# (in the same dir as the app)
+# this shouldn't be necessary except for the non-bundle case on Mac
+function(gp_item_default_embedded_path_override item path)
+ set(path "@executable_path" PARENT_SCOPE)
+endfunction(gp_item_default_embedded_path_override)
+
+include(BundleUtilities)
+fixup_bundle("${OUTPUT}" "${OUTPUT_MODULE}" "${INPUTDIR}")
+
+# make sure we can run the app
+execute_process(COMMAND "${OUTPUT}" RESULT_VARIABLE result)
+
+if(NOT result STREQUAL "0")
+ message(FATAL_ERROR " failed to execute test program")
+endif(NOT result STREQUAL "0")