Linking Core foundation frameworks

How can I link in a core foundation framework from apple?

I have a project that includes this:

include <CoreFoundation/CoreFoundation.h>

and uses this class CFStringCreateWithCString

Im not sure how to link in core foundation frameworks please help!

I’ve tried this:

executables{

envivo{

binaries.all {

cppCompiler.define ‘DEBUG’

cppCompiler.args ‘-std=c++11 -framework System/Library/Frameworks/CoreFoundation.framework’

}

}

}

Which gives me this error:

lonimac003:cpp matthew_casey$ gradle envivoExecutable main configure :compileEnvivoExecutableEnvivoCpp error: invalid value ‘c++11 -framework System/Library/Frameworks/CoreFoundation.framework’ in ‘-std=c++11 -framework System/Library/Frameworks/CoreFoundation.framework’ :compileEnvivoExecutableEnvivoCpp FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ‘:compileEnvivoExecutableEnvivoCpp’. > C++ compiler failed; see the error output for details.

OK I found the solution, i needed to specify it as a linker argument not a compiler argument:

executables{

envivo{

binaries.all {

cppCompiler.define ‘DEBUG’

cppCompiler.args ‘-std=c++11’

linker.args ‘-framework’, ‘CoreFoundation’

}

}

}