FindXCTest: Xcode >= 12.5 fails to compile app with tests with CMake > 3.19.2
Following CMake script
cmake_minimum_required (VERSION 3.19)
project (testapp VERSION 1.0 LANGUAGES Swift)
set(CMAKE_Swift_LANGUAGE_VERSION 5)
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED NO)
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
find_package (XCTest REQUIRED)
add_executable (testapp MACOSX_BUNDLE dummy_main.swift)
xctest_add_bundle (testapp-bundle testapp dummy_main.swift)
After configuration and build with cmake -GXcode -T buildsystem=12 .. && cmake --build .
where CMake > 3.19.2 and Xcode >= 12.5.
Leads to the following errors:
error: Multiple commands produce '/Projects/temp/cmake-xcode12.5/build/Debug-iphonesimulator/testapp.app':
1) CreateBuildDirectory /Projects/temp/cmake-xcode12.5/build/Debug-iphonesimulator/testapp.app
2) Target 'testapp' has create directory command with output '/Projects/temp/cmake-xcode12.5/build/Debug-iphonesimulator/testapp.app'
The issue is related to fix #20662 (closed) which probably must be applied only to Xcode < 12.5. Fix is upcoming...
Edited by Brad King