diff options
author | Gregor Jasny <gjasny@googlemail.com> | 2022-03-24 21:01:09 (GMT) |
---|---|---|
committer | Gregor Jasny <gjasny@googlemail.com> | 2022-04-03 20:39:34 (GMT) |
commit | 53ca6edd8aefcb6456755f2de48d2d1375d6df7f (patch) | |
tree | 9657713940092155470eac78ce7cfb84b16c3fa8 /Tests/RunCMake/XcodeProject | |
parent | 183b6bbf51d40be9a0d54e351538c6413ad41407 (diff) | |
download | CMake-53ca6edd8aefcb6456755f2de48d2d1375d6df7f.zip CMake-53ca6edd8aefcb6456755f2de48d2d1375d6df7f.tar.gz CMake-53ca6edd8aefcb6456755f2de48d2d1375d6df7f.tar.bz2 |
xcode: add support for xcconfig files
Fixes: #18420
Diffstat (limited to 'Tests/RunCMake/XcodeProject')
7 files changed, 45 insertions, 0 deletions
diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index fa26c3d..80c6b73 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -141,6 +141,16 @@ endfunction() XcodeRemoveExcessiveISystem() +function(XcodeXCConfig) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeXCConfig-build) + run_cmake(XcodeXCConfig) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(XcodeXCConfig-build ${CMAKE_COMMAND} --build . --config Debug) + run_cmake_command(XcodeXCConfig-build ${CMAKE_COMMAND} --build . --config Release) +endfunction() + +XcodeXCConfig() + # Isolate device tests from host architecture selection. unset(ENV{CMAKE_OSX_ARCHITECTURES}) diff --git a/Tests/RunCMake/XcodeProject/XcodeXCConfig.c b/Tests/RunCMake/XcodeProject/XcodeXCConfig.c new file mode 100644 index 0000000..ac59a6b --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeXCConfig.c @@ -0,0 +1,20 @@ +#ifndef BUILD_DEBUG +# error BUILD_DEBUG is undefined +#endif +#ifndef GLOBAL_DEBUG +# error GLOBAL_DEBUG is undefined +#endif +#ifndef TARGET_DEBUG +# error TARGET_DEBUG is undefined +#endif + +#if GLOBAL_DEBUG != BUILD_DEBUG +# error GLOBAL_DEBUG does not match BUILD_DEBUG +#endif +#if TARGET_DEBUG != BUILD_DEBUG +# error TARGET_DEBUG does not match BUILD_DEBUG +#endif + +void some_symbol() +{ +} diff --git a/Tests/RunCMake/XcodeProject/XcodeXCConfig.cmake b/Tests/RunCMake/XcodeProject/XcodeXCConfig.cmake new file mode 100644 index 0000000..58d2616 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeXCConfig.cmake @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.23) + +project(XcodeXCConfig C) + +set(CMAKE_XCODE_XCCONFIG "$<IF:$<CONFIG:Debug>,XcodeXCConfig.global.debug.xcconfig,XcodeXCConfig.global.release.xcconfig>") + +add_library(somelib XcodeXCConfig.c) +target_compile_definitions(somelib PUBLIC "BUILD_DEBUG=$<IF:$<CONFIG:Debug>,1,0>") +set_target_properties(somelib PROPERTIES + XCODE_XCCONFIG "$<IF:$<CONFIG:Debug>,XcodeXCConfig.target.debug.xcconfig,XcodeXCConfig.target.release.xcconfig>" +) diff --git a/Tests/RunCMake/XcodeProject/XcodeXCConfig.global.debug.xcconfig b/Tests/RunCMake/XcodeProject/XcodeXCConfig.global.debug.xcconfig new file mode 100644 index 0000000..6749095 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeXCConfig.global.debug.xcconfig @@ -0,0 +1 @@ +OTHER_CFLAGS = $(inherited) -DGLOBAL_DEBUG=1 diff --git a/Tests/RunCMake/XcodeProject/XcodeXCConfig.global.release.xcconfig b/Tests/RunCMake/XcodeProject/XcodeXCConfig.global.release.xcconfig new file mode 100644 index 0000000..6af304d --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeXCConfig.global.release.xcconfig @@ -0,0 +1 @@ +OTHER_CFLAGS = $(inherited) -DGLOBAL_DEBUG=0 diff --git a/Tests/RunCMake/XcodeProject/XcodeXCConfig.target.debug.xcconfig b/Tests/RunCMake/XcodeProject/XcodeXCConfig.target.debug.xcconfig new file mode 100644 index 0000000..731eba2 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeXCConfig.target.debug.xcconfig @@ -0,0 +1 @@ +OTHER_CFLAGS = $(inherited) -DTARGET_DEBUG=1 diff --git a/Tests/RunCMake/XcodeProject/XcodeXCConfig.target.release.xcconfig b/Tests/RunCMake/XcodeProject/XcodeXCConfig.target.release.xcconfig new file mode 100644 index 0000000..b98acb5 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeXCConfig.target.release.xcconfig @@ -0,0 +1 @@ +OTHER_CFLAGS = $(inherited) -DTARGET_DEBUG=0 |