Merge topic 'xcode-test-schema-generation'

3fd9f4ab Xcode: Add test for schema generation
cf13e495 Xcode: Control schema generation via variable

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !577
This commit is contained in:
Brad King 2017-03-13 12:58:48 +00:00 committed by Kitware Robot
commit 22908e4be8
7 changed files with 26 additions and 6 deletions

View File

@ -46,7 +46,6 @@ Properties of Global Scope
/prop_gbl/TARGET_SUPPORTS_SHARED_LIBS
/prop_gbl/USE_FOLDERS
/prop_gbl/XCODE_EMIT_EFFECTIVE_PLATFORM_NAME
/prop_gbl/XCODE_GENERATE_SCHEME
.. _`Directory Properties`:

View File

@ -87,6 +87,7 @@ Variables that Provide Information
/variable/CMAKE_VS_PLATFORM_TOOLSET_CUDA
/variable/CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE
/variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION
/variable/CMAKE_XCODE_GENERATE_SCHEME
/variable/CMAKE_XCODE_PLATFORM_TOOLSET
/variable/PROJECT-NAME_BINARY_DIR
/variable/PROJECT-NAME_SOURCE_DIR

View File

@ -3,4 +3,4 @@ cmake-xcode-schemes
* The :generator:`Xcode` generator got the ability to create schema files.
This is still an experimental feature and can be activated by setting the
:prop_gbl:`XCODE_GENERATE_SCHEME` global property to a ``TRUE`` value.
:variable:`CMAKE_XCODE_GENERATE_SCHEME` variable to a ``TRUE`` value.

View File

@ -1,5 +1,5 @@
XCODE_GENERATE_SCHEME
---------------------
CMAKE_XCODE_GENERATE_SCHEME
---------------------------
If enabled, the Xcode generator will generate schema files. Those are
are useful to invoke analyze, archive, build-for-testing and test

View File

@ -3341,8 +3341,7 @@ void cmGlobalXCodeGenerator::OutputXCodeProject(
// Since the lowest available Xcode version for testing was 7.0,
// I'm setting this as a limit then
if (this->GetCMakeInstance()->GetState()->GetGlobalPropertyAsBool(
"XCODE_GENERATE_SCHEME") &&
if (root->GetMakefile()->IsOn("CMAKE_XCODE_GENERATE_SCHEME") &&
this->XcodeVersion >= 70) {
this->OutputXCodeSharedSchemes(xcodeDir);
this->OutputXCodeWorkspaceSettings(xcodeDir);

View File

@ -187,3 +187,19 @@ if(NOT XCODE_VERSION VERSION_LESS 5)
unset(RunCMake_TEST_NO_CLEAN)
unset(RunCMake_TEST_OPTIONS)
endif()
function(XcodeSchemaGeneration)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeSchemaGeneration-build)
set(RunCMake_TEST_NO_CLEAN 1)
set(RunCMake_TEST_OPTIONS "-DCMAKE_XCODE_GENERATE_SCHEME=ON")
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
run_cmake(XcodeSchemaGeneration)
run_cmake_command(XcodeSchemaGeneration-build xcodebuild -scheme foo build)
endfunction()
if(NOT XCODE_VERSION VERSION_LESS 7)
XcodeSchemaGeneration()
endif()

View File

@ -0,0 +1,5 @@
cmake_minimum_required(VERSION 3.7)
project(XcodeSchemaGeneration CXX)
add_executable(foo main.cpp)