Skip to content

Commit

Permalink
Xcode: Add unit test for iOS project install (#12506)
Browse files Browse the repository at this point in the history
  • Loading branch information
gjasny committed Aug 15, 2015
1 parent 5941476 commit dcfc8f6
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,19 @@ run_cmake(XcodeObjectNeedsQuote)
if (NOT XCODE_VERSION VERSION_LESS 6)
run_cmake(XcodePlatformFrameworks)
endif()

# Use a single build tree for a few tests without cleaning.

set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeInstallIOS-build)
set(RunCMake_TEST_NO_CLEAN 1)
set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_BINARY_DIR}/ios_install")

file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")

run_cmake(XcodeInstallIOS)
run_cmake_command(XcodeInstallIOS-install ${CMAKE_COMMAND} --build . --target install)

unset(RunCMake_TEST_BINARY_DIR)
unset(RunCMake_TEST_NO_CLEAN)
unset(RunCMake_TEST_OPTIONS)
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Install configuration: .*
-- Installing: .*/ios_install/lib/libfoo.a
12 changes: 12 additions & 0 deletions Tests/RunCMake/XcodeProject/XcodeInstallIOS.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
cmake_minimum_required(VERSION 2.8.5)

project(XcodeInstallIOS)

set(CMAKE_OSX_SYSROOT iphoneos)
set(XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")

set(CMAKE_OSX_ARCHITECTURES "armv7;i386")
set(CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos;-iphonesimulator")

add_library(foo STATIC foo.cpp)
install(TARGETS foo ARCHIVE DESTINATION lib)
1 change: 1 addition & 0 deletions Tests/RunCMake/XcodeProject/foo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
void foo() { }

0 comments on commit dcfc8f6

Please sign in to comment.