Skip to content

Cmake fails to configure with Xcode generator #121210

Open
@SteveMontgomery

Description

@SteveMontgomery

I checked out the main branch. Cmake fails when configuring for the Xcode generator when clang is included in the project list. The same command with the Ninja generator works fine, i.e.

$ cmake --fresh -G "Xcode" -DCMAKE_BUILD_TYPE=Debug -DLLVM_ENABLE_PROJECTS=clang ../llvm
fails

$ cmake --fresh -G "Xcode" -DCMAKE_BUILD_TYPE=Debug ../llvm
configures OK

$ cmake --fresh -G "Ninja" -DCMAKE_BUILD_TYPE=Debug -DLLVM_ENABLE_PROJECTS=clang ../llvm
configures OK

When configuring for Xcode with clang enabled, there are multiple error messages of the form:
CMake Error at /Users/Steve/Development/llvm-project/clang/cmake/modules/AddClang.cmake:119 (target_compile_definitions):
Cannot specify compile definitions for target "obj.clangBasic" which is not
built by this project.
Call Stack (most recent call first):
/Users/Steve/Development/llvm-project/clang/lib/Basic/CMakeLists.txt:57 (add_clang_library)

I tracked this down to commit 09fa2f0 which certainly seems relevant given it's modified clang/cmake/modules/AddClang.cmake.

Metadata

Metadata

Assignees

No one assigned

    Labels

    cmakeBuild system in general and CMake in particular

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions