diff options
author | Brad King <brad.king@kitware.com> | 2015-09-01 13:53:30 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-09-01 13:53:30 (GMT) |
commit | dd2b88777fa549bf261a84a0914a5a8171ae0a56 (patch) | |
tree | c53d82b24bfe5b4fd732a7ffaf4e76260cf028d1 | |
parent | 0e08ab6ef165791e582fce9aecc2a288075a7da4 (diff) | |
parent | ad262917d96aa4d6faeff3c9dfecf684cebbe123 (diff) | |
download | CMake-dd2b88777fa549bf261a84a0914a5a8171ae0a56.zip CMake-dd2b88777fa549bf261a84a0914a5a8171ae0a56.tar.gz CMake-dd2b88777fa549bf261a84a0914a5a8171ae0a56.tar.bz2 |
Merge topic 'fix-ios-install'
ad262917 Xcode: Add unit test for iOS project install (#12506)
48fe617e Fix installation of iOS targets (#12506)
d2c2319d Replace CMAKE_XCODE_EFFECTIVE_PLATFORMS with call to PlatformIsAppleIos
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 12 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 5 | ||||
-rw-r--r-- | Tests/RunCMake/XcodeProject/RunCMakeTest.cmake | 14 | ||||
-rw-r--r-- | Tests/RunCMake/XcodeProject/XcodeBundles.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/XcodeProject/XcodeInstallIOS-install-stdout.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/XcodeProject/XcodeInstallIOS.cmake | 12 | ||||
-rw-r--r-- | Tests/RunCMake/XcodeProject/foo.cpp | 1 | ||||
-rw-r--r-- | Tests/iOSNavApp/CMakeLists.txt | 1 |
8 files changed, 42 insertions, 6 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index ec36d2a..49f3b29 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2422,7 +2422,17 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) if ( cmakeCfgIntDir && *cmakeCfgIntDir && cmakeCfgIntDir[0] != '.' ) { std::string cfgArg = "-DBUILD_TYPE="; - cfgArg += mf->GetDefinition("CMAKE_CFG_INTDIR"); + bool iosPlatform = mf->PlatformIsAppleIos(); + if(iosPlatform) + { + cfgArg += "$(CONFIGURATION)"; + singleLine.push_back(cfgArg); + cfgArg = "-DEFFECTIVE_PLATFORM_NAME=$(EFFECTIVE_PLATFORM_NAME)"; + } + else + { + cfgArg += mf->GetDefinition("CMAKE_CFG_INTDIR"); + } singleLine.push_back(cfgArg); } singleLine.push_back("-P"); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 4affc8d..590654d 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2901,10 +2901,9 @@ bool cmTarget::ComputeOutputDir(const std::string& config, // The generator may add the configuration's subdirectory. if(!conf.empty()) { - const char *platforms = this->Makefile->GetDefinition( - "CMAKE_XCODE_EFFECTIVE_PLATFORMS"); + bool iosPlatform = this->Makefile->PlatformIsAppleIos(); std::string suffix = - usesDefaultOutputDir && platforms ? "$(EFFECTIVE_PLATFORM_NAME)" : ""; + usesDefaultOutputDir && iosPlatform ? "${EFFECTIVE_PLATFORM_NAME}" : ""; this->Makefile->GetGlobalGenerator()-> AppendDirectoryForConfig("/", conf, suffix, out); } diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index 1151abf..8ab618b 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -11,6 +11,20 @@ endif() # Use a single build tree for a few tests without cleaning. if(NOT XCODE_VERSION VERSION_LESS 5) + 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) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeBundlesOSX-build) set(RunCMake_TEST_NO_CLEAN 1) set(RunCMake_TEST_OPTIONS "-DTEST_IOS=OFF") diff --git a/Tests/RunCMake/XcodeProject/XcodeBundles.cmake b/Tests/RunCMake/XcodeProject/XcodeBundles.cmake index d5cb51f..2cbccfa 100644 --- a/Tests/RunCMake/XcodeProject/XcodeBundles.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeBundles.cmake @@ -6,7 +6,6 @@ enable_language(C) if(TEST_IOS) set(CMAKE_OSX_SYSROOT iphoneos) set(CMAKE_OSX_ARCHITECTURES "armv7") - set(CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos;-iphonesimulator") set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") endif(TEST_IOS) diff --git a/Tests/RunCMake/XcodeProject/XcodeInstallIOS-install-stdout.txt b/Tests/RunCMake/XcodeProject/XcodeInstallIOS-install-stdout.txt new file mode 100644 index 0000000..f2478be --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeInstallIOS-install-stdout.txt @@ -0,0 +1,2 @@ +-- Install configuration: .* +-- Installing: .*/ios_install/lib/libfoo.a diff --git a/Tests/RunCMake/XcodeProject/XcodeInstallIOS.cmake b/Tests/RunCMake/XcodeProject/XcodeInstallIOS.cmake new file mode 100644 index 0000000..a797410 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeInstallIOS.cmake @@ -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_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") + +set(CMAKE_OSX_ARCHITECTURES "armv7;i386") + +add_library(foo STATIC foo.cpp) +install(TARGETS foo ARCHIVE DESTINATION lib) diff --git a/Tests/RunCMake/XcodeProject/foo.cpp b/Tests/RunCMake/XcodeProject/foo.cpp new file mode 100644 index 0000000..2fb55ee --- /dev/null +++ b/Tests/RunCMake/XcodeProject/foo.cpp @@ -0,0 +1 @@ +void foo() { } diff --git a/Tests/iOSNavApp/CMakeLists.txt b/Tests/iOSNavApp/CMakeLists.txt index 12c3ada..1fc33e0 100644 --- a/Tests/iOSNavApp/CMakeLists.txt +++ b/Tests/iOSNavApp/CMakeLists.txt @@ -3,7 +3,6 @@ project(NavApp3) set(CMAKE_OSX_SYSROOT iphoneos4.3) set(CMAKE_OSX_ARCHITECTURES "armv6;armv7;i386") -set(CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos;-iphonesimulator") include_directories( ${CMAKE_CURRENT_SOURCE_DIR} |