[CMake] CMAKE_SYSROOT and CMAKE_OSX_SYSROOT

James Weir james.weir at wesio.co.uk
Mon Mar 26 05:19:46 EDT 2018


I’ve recently been experimenting with using Conan as a package manager for our C++ components, the good news is most things work really well but I’ve come across something which I’m not sure what the behaviour should be with regards to CMake. The problem occurs for me when building for Darwin targets (macOS and iOS), specifically around the behaviour of CMAKE_SYSROOT and CMAKE_OSX_SYSROOT.

In short conan cmake builder sets CMAKE_SYSROOT but not CMAKE_OSX_SYSROOT and this causes me problems as I end up with multiple isysroot parameters given to the compiler, typically the host one trumps and so I end up with build errors due to trying to use includes from the macOS platform SDK rather than the appropriate iOS one. I can work around it by setting CMAKE_OSX_SYSROOT explicitly to to the same as CMAKE_SYSROOT and then everything works correctly, but could someone tell me why there are two SYSROOTs in the first place and what the expected behaviour should be?

Thanks!


More information about the CMake mailing list