diff options
author | Brad King <brad.king@kitware.com> | 2016-03-17 13:41:37 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2016-03-17 13:41:37 (GMT) |
commit | cd569b962dbeaa7ea718021c16582cddd158df3a (patch) | |
tree | 67b357ab206985b5a8b9de70a35e17ed5cb0c8a1 /Tests/RunCMake | |
parent | f6d66b04a36c263d8cc6c01d9b628168dae42d85 (diff) | |
parent | e3fc2899c89fb075a695d6140eaadf11db85d96c (diff) | |
download | CMake-cd569b962dbeaa7ea718021c16582cddd158df3a.zip CMake-cd569b962dbeaa7ea718021c16582cddd158df3a.tar.gz CMake-cd569b962dbeaa7ea718021c16582cddd158df3a.tar.bz2 |
Merge topic 'ios-install-combined-one-arch'
e3fc2899 Fix iOS combined feature for single architecture targets
Diffstat (limited to 'Tests/RunCMake')
3 files changed, 64 insertions, 0 deletions
diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index 395c74b..b77d5d4 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -97,6 +97,7 @@ if(NOT XCODE_VERSION VERSION_LESS 7) endif() if(NOT XCODE_VERSION VERSION_LESS 6) + # XcodeIOSInstallCombined set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombined-build) set(RunCMake_TEST_NO_CLEAN 1) set(RunCMake_TEST_OPTIONS @@ -114,6 +115,7 @@ if(NOT XCODE_VERSION VERSION_LESS 6) unset(RunCMake_TEST_NO_CLEAN) unset(RunCMake_TEST_OPTIONS) + # XcodeIOSInstallCombinedPrune set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombinedPrune-build) set(RunCMake_TEST_NO_CLEAN 1) set(RunCMake_TEST_OPTIONS @@ -130,4 +132,22 @@ if(NOT XCODE_VERSION VERSION_LESS 6) unset(RunCMake_TEST_BINARY_DIR) unset(RunCMake_TEST_NO_CLEAN) unset(RunCMake_TEST_OPTIONS) + + # XcodeIOSInstallCombinedSingleArch + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombinedSingleArch-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OPTIONS + "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install" + "-DCMAKE_IOS_INSTALL_COMBINED=YES") + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(XcodeIOSInstallCombinedSingleArch) + run_cmake_command(XcodeIOSInstallCombinedSingleArch-build ${CMAKE_COMMAND} --build .) + run_cmake_command(XcodeIOSInstallCombinedSingleArch-install ${CMAKE_COMMAND} --build . --target install) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) + unset(RunCMake_TEST_OPTIONS) endif() diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-install-check.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-install-check.cmake new file mode 100644 index 0000000..3c11ae0 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-install-check.cmake @@ -0,0 +1,25 @@ +function(verify_architecture file) + execute_process( + COMMAND xcrun lipo -info ${RunCMake_TEST_BINARY_DIR}/_install/${file} + OUTPUT_VARIABLE lipo_out + ERROR_VARIABLE lipo_err + RESULT_VARIABLE lipo_result) + if(NOT lipo_result EQUAL "0") + message(SEND_ERROR "lipo -info failed: ${lipo_err}") + return() + endif() + + string(REGEX MATCHALL "is architecture: [^ \n\t]+" architecture "${lipo_out}") + string(REGEX REPLACE "is architecture: " "" actual "${architecture}") + + set(expected armv7) + + if(NOT actual STREQUAL expected) + message(SEND_ERROR + "The actual library architecture:\n ${actual} \n" + "which do not match expected ones:\n ${expected} \n" + "lipo output:\n${lipo_out}") + endif() +endfunction() + +verify_architecture(lib/libfoo.dylib) diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake new file mode 100644 index 0000000..4b5e7ce --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 3.3) + +project(XcodeIOSInstallCombinedSingleArch CXX) + +set(CMAKE_OSX_SYSROOT iphoneos) +set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") +set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf") + +add_library(foo SHARED foo.cpp) +install(TARGETS foo DESTINATION lib) + +set_target_properties( + foo + PROPERTIES + XCODE_ATTRIBUTE_ARCHS[sdk=iphoneos*] armv7 + XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphoneos*] armv7 + XCODE_ATTRIBUTE_ARCHS[sdk=iphonesimulator*] "" + XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphonesimulator*] "" +) |