[cmake-developers] [PATCH 0/5] XCTest Bundles v3

Gregor Jasny gjasny at googlemail.com
Sat Feb 14 15:32:54 EST 2015


Hello,

I made some more progress with XCTest bundles. The major difference to
the last patch series is that I don't set any target properties on the
testee from within the generator anymore. Instead I utilizes some
helper functions (in XCTestUtilities.cmake). This also sanitizes error
handling because everything happens in Script context.

For now I focussed on XCTest bundles for Frameworks because they are
better testable than Cocoa App Bundles. I will add missing
functionality
to XCTestUtilities.cmake later. This won't require any new changes to
the cmake binary because genrator expression for XCODE attributes were
already merged. (Thanks Brad!).

The first three patches add some plumbing to the cmake binary. The
fourth one adds the helper and the last one the example.

You could test the patches as follows:

  cd Tests/XCTest
  mkdir _build_make _build_xcode
  cd _build_make
  ../../../bin/cmake ..
  ../../../bin/cmake --build .
  ../../../bin/ctest --verbose

  cd ../_build_xcode
  ../../../bin/cmake -GXcode ..
  ../../../bin/cmake --build . --config Debug
  ../../../bin/ctest --verbose -C Debug
  (or within Xcode)
  open XCTestFramework.xcodeproj
  Select Framework.example scheme
  Product->Test (or CMD-U)
  View->Navigator->Test (CMD-5)

I could need a helping hand with creating and wiring up tests for the
patches. For example the Platform Framework search path:

It should only get tested if the sysroot belongs to XCode 5 or
later. I fear this is a rather complex condition to test for. It would
be easier to check if the SDK is greater or equal to
10.9. Unfortunately the SDK version is not exported from
Platform/Darwin.cmake. 

Similar for Tests/XCTest.

One question about ctest: If I built cmake with command line make or
ninja (which bootstraps far faster than Xcode), can I tell ctest to
generate projects with Xcode? Or use a certain CMAKE_OSX_SYSROOT?

Thanks,
Gregor

Gregor Jasny (5):
  Add handling for XCTest bundles
  Shorten CFBundleExecutable to file name only
  Also add Platform specific Frameworks to Darwin Framework search path
  Add XCTest helper utilities
  Add XCTest example to test Frameworks

 Help/manual/cmake-properties.7.rst                 |  1 +
 Help/prop_tgt/XCTEST.rst                           | 10 ++++
 Modules/Platform/Darwin.cmake                      |  5 ++
 Modules/XCTestUtilities.cmake                      | 58 ++++++++++++++++++++++
 Source/cmGlobalXCodeGenerator.cxx                  | 12 ++++-
 Source/cmOSXBundleGenerator.cxx                    |  3 +-
 Source/cmTarget.cxx                                | 16 +++++-
 Source/cmTarget.h                                  |  3 ++
 Tests/XCTest/CMakeLists.txt                        | 38 ++++++++++++++
 Tests/XCTest/FrameworkExample/FrameworkExample.c   |  6 +++
 Tests/XCTest/FrameworkExample/FrameworkExample.h   |  1 +
 Tests/XCTest/FrameworkExample/Info.plist           | 28 +++++++++++
 .../FrameworkExampleTests/FrameworkExampleTests.m  | 16 ++++++
 Tests/XCTest/FrameworkExampleTests/Info.plist      | 24 +++++++++
 Tests/XcodePlatformFrameworks/CMakeLists.txt       | 38 ++++++++++++++
 15 files changed, 255 insertions(+), 4 deletions(-)
 create mode 100644 Help/prop_tgt/XCTEST.rst
 create mode 100644 Modules/XCTestUtilities.cmake
 create mode 100644 Tests/XCTest/CMakeLists.txt
 create mode 100644 Tests/XCTest/FrameworkExample/FrameworkExample.c
 create mode 100644 Tests/XCTest/FrameworkExample/FrameworkExample.h
 create mode 100644 Tests/XCTest/FrameworkExample/Info.plist
 create mode 100644 Tests/XCTest/FrameworkExampleTests/FrameworkExampleTests.m
 create mode 100644 Tests/XCTest/FrameworkExampleTests/Info.plist
 create mode 100644 Tests/XcodePlatformFrameworks/CMakeLists.txt

-- 
2.3.0



More information about the cmake-developers mailing list