I need to add a specific MacOSX framework in my CMake files. In my MacOSX machine they are installed SDK 10.9 and 10.10, and in particular I want to use 10.10.
The line I want to add is the following:
target_link_libraries(myappexecutable -framework /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/ApplicationServices.framework/ApplicationServices)
but somehow the 10.9 SDK is mixed therein because I have errors like
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/LSInfo.h:922:63: error: expected function body after function declarator
CFErrorRef * outError) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_NA);
Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/Availability.h:159:50: note: expanded from macro '__OSX_AVAILABLE_STARTING'
#define __OSX_AVAILABLE_STARTING(_osx, _ios) __AVAILABILITY_INTERNAL##_osx
What I suppose is that somehow the header files are taken from the SDK 10.9, as far as I understand from the path MacOSX10.9.sdk/usr/include/Availability.h
How can I tell the framework to search in the proper include directory?
I tried to add
include_directories(/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include)
but it seems not working.
What am I doing wrong?
(ps I prefer not to use find_library(), as for example in this question)
To give you some more context, I am switching from qmake to cmake. The corresponding line in qmake was
LIBS += -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks -framework ApplicationServices
and it is working as expected.