'How can I set “Other Linker Flags” to include -ObjC with CMake?

I am trying to generate an XCode project with CMake, but I can't define "Other linker flags" in project settings. I have tried using the following:

set(CMAKE_SHARED_LINKER_FLAGS "-ObjC")

and

target_link_options(my_project_target PUBLIC "LINKER:-ObjC")

and

add_link_options("-ObjC")

unlike similar posts, I am not trying to link a framework or library, I want to specifically set the -ObjC linker flag.



Solution 1:[1]

You can try target_link_libraries

target_link_libraries("-ObjC")

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 SkyLan