Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mixing Swift in ObjC: "fatal error: 'ObjcSwiftNinja-Swift.h' file not found" #2261

Closed
Coeur opened this issue Feb 19, 2023 · 2 comments
Closed

Comments

@Coeur
Copy link

Coeur commented Feb 19, 2023

While it works fine with Xcode, I seem unable to use Ninja to build a mixed ObjC+Swift project. I get:

/Users/User/Developer/ObjcSwiftNinja/MyObjC.m:2:9: fatal error: 'ObjcSwiftNinja-Swift.h' file not found
#import "ObjcSwiftNinja-Swift.h"
        ^~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

Minimal sample project: https://github.com/Coeur/ObjcSwiftNinja

The CMakeList.txt is as minimal as possible to highlight the issue:
https://github.com/Coeur/ObjcSwiftNinja/blob/97d926d454a8210731b42ddcc92c3a7fbc72ff9a/CMakeLists.txt

The README gives what works and what fails.
Succeeds:

cmake -B build -G Xcode
xcodebuild -project build/ObjcSwiftNinja.xcodeproj -target ObjcSwiftNinja-app

Fails:

cmake -B build -G Ninja
ninja -C build ObjcSwiftNinja-app
@jhasse
Copy link
Collaborator

jhasse commented Mar 4, 2023

This is a CMake issue, please open an issue in their bug tracker.

@jhasse jhasse closed this as completed Mar 4, 2023
@Coeur
Copy link
Author

Coeur commented Mar 5, 2023

Issue in cmake tracker: https://gitlab.kitware.com/cmake/cmake/-/issues/24571

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants