Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • CMake CMake
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 4,105
    • Issues 4,105
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 16
    • Merge requests 16
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMakeCMake
  • CMakeCMake
  • Issues
  • #19998
Closed
Open
Issue created Nov 20, 2019 by Tobias Hieta@truContributor

Xcode generator doesn't set correct explicitFileType based on LANGUAGE for Objective-C++ files

Hello!

I noticed another issue with the Objective-C++ support and the Xcode generator. It turns out that the Xcode generator doesn't seem to care about the LANGUAGE property on source files.

I have the following CMakeLists.txt:

cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
project(test-objc C CXX OBJCXX)
add_executable(hello hello.cpp)
set_source_files_properties(hello.cpp PROPERTIES LANGUAGE OBJCXX)

This works fine with Ninja and Makefiles but not with Xcode - the file is not built at all.

I traced it down to the explicitFileType being set to sourcecode:

3DE340914549401FBA1AD8F4 /* /Users/tobias/Code/objc-xcode/hello.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode; fileEncoding = 4; name = hello.cpp; path = hello.cpp; sourceTree = SOURCE_ROOT; }

I can get around this by setting: XCODE_EXPLICIT_FILE_TYPE sourcecode.cpp.objcpp on the source file so it's not a breaking bug. But it seems like maybe CMake should handle this case.

I think the problem is here:

https://gitlab.kitware.com/cmake/cmake/blob/v3.16.0-rc4/Source/cmGlobalXCodeGenerator.cxx#L941

This switch statement probably need to check for objective-c and objective-c++.

Edited Nov 20, 2019 by Brad King
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking