[Cmake-commits] [cmake-commits] david.cole committed BundleLib.cxx 1.3 1.4 BundleTest.cxx 1.3 1.4 CMakeLists.txt 1.10 1.11

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Sep 2 11:07:07 EDT 2008


Update of /cvsroot/CMake/CMake/Tests/BundleTest
In directory public:/mounts/ram/cvs-serv31553

Modified Files:
	BundleLib.cxx BundleTest.cxx CMakeLists.txt 
Log Message:
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.


Index: BundleTest.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/BundleTest/BundleTest.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -C 2 -d -r1.3 -r1.4
*** BundleTest.cxx	28 Mar 2006 18:23:10 -0000	1.3
--- BundleTest.cxx	2 Sep 2008 15:07:00 -0000	1.4
***************
*** 1,4 ****
--- 1,6 ----
  #include <stdio.h>
  
+ #include <Carbon/Carbon.h>
+ 
  extern int foo(char* exec);
  
***************
*** 6,9 ****
--- 8,20 ----
  {
    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]);
  }

Index: CMakeLists.txt
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/BundleTest/CMakeLists.txt,v
retrieving revision 1.10
retrieving revision 1.11
diff -C 2 -d -r1.10 -r1.11
*** CMakeLists.txt	27 Aug 2008 16:53:19 -0000	1.10
--- CMakeLists.txt	2 Sep 2008 15:07:04 -0000	1.11
***************
*** 25,30 ****
  SET(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}/foobar")
  
! # Test building a bundle linking to a shared library.
  ADD_LIBRARY(BundleTestLib SHARED BundleLib.cxx)
  ADD_EXECUTABLE(BundleTest
    MACOSX_BUNDLE
--- 25,38 ----
  SET(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}/foobar")
  
! # 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
***************
*** 34,39 ****
    "${CMAKE_CURRENT_BINARY_DIR}/randomResourceFile.plist"
    )
- 
  TARGET_LINK_LIBRARIES(BundleTest BundleTestLib)
  
  # Test bundle installation.
--- 42,50 ----
    "${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.

Index: BundleLib.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/BundleTest/BundleLib.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -C 2 -d -r1.3 -r1.4
*** BundleLib.cxx	5 Jul 2006 20:27:44 -0000	1.3
--- BundleLib.cxx	2 Sep 2008 15:06:59 -0000	1.4
***************
*** 4,7 ****
--- 4,9 ----
  #include <unistd.h>
  
+ #include <Carbon/Carbon.h>
+ 
  int fileExists(char* filename)
  {
***************
*** 50,53 ****
--- 52,60 ----
  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");



More information about the Cmake-commits mailing list