[cmake-developers] [PATCH v7 0/4] Add XCTest Bundle Support

Brad King brad.king at kitware.com
Fri Feb 27 10:26:16 EST 2015


On 02/26/2015 03:55 PM, Gregor Jasny wrote:
> This approach works properly for Xcode. But when building with the
> Makefile Generator the XCTest framework is not in the default compiler
> search path (but in CMAKE_SYSTEM_FRAMEWORK_PATH).
> 
> So I could use a if(XCODE) conditional to avoid looking up the XCTest
> framework. But consistency across generators is also a nice thing.

Okay.

> Also everything addressed.

Thanks.  I've made some revisions of my own and attached the resulting
series.  Please continue work from this version.  Updates include:

* Simplify addition of XCTest test case.  We only need to test it
  with the same generator as all the other tests.  Our nightly
  testing infrastructure already has separate testing for each
  generator.  This approach also allows the test to run with the
  Ninja generator.

* Add XCTEST_INCLUDE_DIR to XCTestUtilities.  We need it to have
  the proper include directory added for non-Xcode generators.
  I didn't document it yet because of the comment below.

* Changed the way we pass -bundle_loader.  We already support that
  with the ENABLE_EXPORTS target property and target_link_libraries.
  Likely further simplifications of the logic are possible now that
  the approach for testing frameworks and bundles is more similar.
  However, it no longer sets TEST_HOST in the .pbxproj file.
  See below.

With the above the tests pass for me on Xcode, Ninja, and Makefile
generators, and with a space in the path to the source and build
tree.

Further comments:

* The XCTestUtilities module is feeling more like a find module
  now that it finds XCTest components.  Perhaps we should rename
  it to FindXCTest and use find_package(XCTest) to use it.
  Then all the cached and result variables should be named the
  way they are described in the cmake-developer(7) manual.
  If it is not provided as a find module then we should not document
  the result variables because they are implementation details
  of the public APIs.

* The -bundle_loader logic in CMake is here:

   http://www.cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmComputeLinkInformation.cxx;hb=v3.2.0-rc2#l284
   http://www.cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmComputeLinkInformation.cxx;hb=v3.2.0-rc2#l620

  One may need to refactor the Xcode generator support for this
  if setting TEST_HOST in the Xcode project is a requirement.
  Currently the flag just appears in OTHER_LDFLAGS with my above
  approach.

>   if(TESTEE_TYPE STREQUAL "SHARED_LIBRARY" AND TESTEE_FRAMEWORK)
>     set_target_properties(${testee} PROPERTIES
>       BUILD_WITH_INSTALL_RPATH TRUE
>       INSTALL_NAME_DIR "@rpath")

The MACOSX_RPATH target property may be useful here.  See also
documentation of policy CMP0042.

Is this kind of modification of the testee safe?  Will projects
actually want their targets modified by adding tests for them?
Currently the settings will affect how the tested targets are
installed.

Thanks,
-Brad

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Tests-Compute-Xcode-version-for-any-generator-on-OS-.patch
Type: text/x-diff
Size: 1472 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150227/1f975fab/attachment-0005.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-OS-X-Add-handling-for-XCTest-bundles.patch
Type: text/x-diff
Size: 5058 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150227/1f975fab/attachment-0006.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-OS-X-Add-XCTestUtilities-module.patch
Type: text/x-diff
Size: 6425 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150227/1f975fab/attachment-0007.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-Tests-Add-XCTest-example-to-test-Frameworks-and-Coco.patch
Type: text/x-diff
Size: 61201 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150227/1f975fab/attachment-0008.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-Help-Add-notes-for-topic-xcode-xctest.patch
Type: text/x-diff
Size: 1079 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150227/1f975fab/attachment-0009.patch>


More information about the cmake-developers mailing list