I'm building a MacOS Universal Binary using set (CMAKE_OSX_ARCHITECTURES arm64 x86_64)
- working fine so far.
But x86_64 should have other compile options than arm64.
Is there something like:
if (CURRENT_TARGET MATCHES x86_64)
add_compile_options (-Wall -Ofast -ffast-math -fno-exceptions)
else()
add_compile_options (-Wall -O3 -fno-exceptions)
endif()
Or any other solution?
You can do this via the
XCODE_ATTRIBUTE_*
property, though this will unfortunately tie your project to XCode. If you have a targetmy_target
to which you'd like to add multi-arch-specific flags, you would write:Then you would build with: