cedarbdd / cedar

BDD-style testing using Objective-C
http://groups.google.com/group/cedar-discuss
1.19k stars 140 forks source link

Use of @import #377

Open SpaceTrucker2196 opened 8 years ago

SpaceTrucker2196 commented 8 years ago

I mentioned this awhile ago and found a work around, but more and more frameworks appear to be using @import which fails with "Use of @import when modules are disabled." the failing library was imported with cocoapods and I looked at the targets and made sure the setting "Allow Non-modular includes in Framework Modules" was set to yes. When building my project normally the build is successful. It's only my cedar specs target thats failing.

How can I test classes that use or have dependancies that use @import?

briancroom commented 8 years ago

Hey @jkunzelman, the @import feature requires clang modules to be enabled. Clang modules are not well-supported for C++, so they are disabled by default, however it is possible to explicitly turn them on, which may or may not resolve your issues. To turn this on, add -fcxx-modules to the Other C++ Flags build settings in your spec target.

There's a real chance you will run into compiler bugs when doing this, but I have seen this work successfully in some basic smoke testing.

tjarratt commented 8 years ago

Is there a radar that we could duplicate so that apple is aware that people want to use @import from a C++ context?

Another alternative, albeit less exciting answer, is to switch to using Quick and Nimble, which are available for both Objective-C and Swift. It probably won't be easy, and it's not a magic bullet, because you'll still have some strange cases where things fail to compile for one reason or another, but it certainly would resolve your pain with @import, @jkunzelman.