diff options
author | David Cole <david.cole@kitware.com> | 2008-09-02 15:07:04 (GMT) |
---|---|---|
committer | David Cole <david.cole@kitware.com> | 2008-09-02 15:07:04 (GMT) |
commit | a54e97cf946e82de6b73c26c64b7fe3efdf0be43 (patch) | |
tree | 83e2ced27b238b65b902ac0e2c5e9286c48d70dc | |
parent | 698b8044a627293dd6a453c2fa10284000b2f5b1 (diff) | |
download | CMake-a54e97cf946e82de6b73c26c64b7fe3efdf0be43.zip CMake-a54e97cf946e82de6b73c26c64b7fe3efdf0be43.tar.gz CMake-a54e97cf946e82de6b73c26c64b7fe3efdf0be43.tar.bz2 |
ENH: Add indirect dependency to Carbon and call a Carbon function from executable. This will allow detecting broken dependency chaining for '-framework blah' style lib dependencies.
-rw-r--r-- | Tests/BundleTest/BundleLib.cxx | 7 | ||||
-rw-r--r-- | Tests/BundleTest/BundleTest.cxx | 11 | ||||
-rw-r--r-- | Tests/BundleTest/CMakeLists.txt | 15 |
3 files changed, 31 insertions, 2 deletions
diff --git a/Tests/BundleTest/BundleLib.cxx b/Tests/BundleTest/BundleLib.cxx index 4f353fb..bab745e 100644 --- a/Tests/BundleTest/BundleLib.cxx +++ b/Tests/BundleTest/BundleLib.cxx @@ -3,6 +3,8 @@ #include <stdlib.h> #include <unistd.h> +#include <Carbon/Carbon.h> + int fileExists(char* filename) { #ifndef R_OK @@ -49,6 +51,11 @@ int findBundleFile(char* exec, const char* file) int foo(char *exec) { + // Call a "Carbon" function... + // + CFBundleRef br = CFBundleGetMainBundle(); + (void) br; + int res1 = findBundleFile(exec, "Resources/randomResourceFile.plist"); int res2 = findBundleFile(exec, "MacOS/SomeRandomFile.txt"); int res3 = findBundleFile(exec, "MacOS/ChangeLog.txt"); diff --git a/Tests/BundleTest/BundleTest.cxx b/Tests/BundleTest/BundleTest.cxx index 1e508ac..29d17db 100644 --- a/Tests/BundleTest/BundleTest.cxx +++ b/Tests/BundleTest/BundleTest.cxx @@ -1,9 +1,20 @@ #include <stdio.h> +#include <Carbon/Carbon.h> + extern int foo(char* exec); int main(int argc, char* argv[]) { printf("Started with: %d arguments\n", argc); + + // Call a "Carbon" function... but pull in the link dependency on "-framework + // Carbon" via CMake's dependency chaining mechanism. This code exists to + // verify that the chaining mechanism works with "-framework blah" style + // link dependencies. + // + CFBundleRef br = CFBundleGetMainBundle(); + (void) br; + return foo(argv[0]); } diff --git a/Tests/BundleTest/CMakeLists.txt b/Tests/BundleTest/CMakeLists.txt index 86e6232..5ccf2bf 100644 --- a/Tests/BundleTest/CMakeLists.txt +++ b/Tests/BundleTest/CMakeLists.txt @@ -24,8 +24,16 @@ SET_SOURCE_FILES_PROPERTIES( SET(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}/foobar") -# Test building a bundle linking to a shared library. +# Test building a bundle linking to a shared library where the +# shared library links to Carbon, but the executable does not +# explicitly link to Carbon, but the executable does *depend* +# on Carbon. There should be a link failure for the executable +# if CMake's dependency chaining for libraries with "-framework +# blah" style dependencies gets broken... +# ADD_LIBRARY(BundleTestLib SHARED BundleLib.cxx) +TARGET_LINK_LIBRARIES(BundleTestLib "-framework Carbon") + ADD_EXECUTABLE(BundleTest MACOSX_BUNDLE BundleTest.cxx @@ -33,8 +41,11 @@ ADD_EXECUTABLE(BundleTest "${BundleTest_SOURCE_DIR}/../../ChangeLog.txt" "${CMAKE_CURRENT_BINARY_DIR}/randomResourceFile.plist" ) - TARGET_LINK_LIBRARIES(BundleTest BundleTestLib) +# +# DO NOT: TARGET_LINK_LIBRARIES(BundleTest "-framework Carbon") +# (see above comments about Carbon) +# # Test bundle installation. #INSTALL(TARGETS BundleTestLib DESTINATION Applications/BundleTestExe.app/Contents/Plugins) |