Xcode: CMake SIGSEGV (Address boundary error) on Mojave with Xcode 10.2
Noticing a crash when running with Xcode generator on Mojave with Xcode 10.2 specifically on this line as it seems that group can be null. Guarding the children lookup with if (group)
seems to be enough to circumvent the crash, but the origin of the cause looks a bit deeper.
Reproducing example with cmake -G Xcode -DCMAKE_SYSTEM_NAME=iOS
:
Add in root folder following CMakeLists.txt
cmake_minimum_required(VERSION 3.14)
add_subdirectory(subdir)
Add in subdir folder following CMakeLists.txt
project(testa)
add_executable(${PROJECT_NAME}
test.cpp
test2.cpp
)
project(testb)
add_executable(${PROJECT_NAME}
$<TARGET_PROPERTY:testa,SOURCES>
)
The usage of the generator expression to obtain sources is resulting in picking up testa Info.plist from the output directory, which will cause the crash as mentioned before. This only happens with the subdirectory case, as if you move the two executable definitions to the root folder CMakeLists.txt the crash is not happening!