[cmake-developers] Issue on CMAKE_OSX_SYSROOT
Francesco Romano
francesco.romano.1987 at gmail.com
Tue Oct 6 09:49:13 EDT 2015
Thanks Brad for the answer.
Maybe I did not understand correctly your answers.
I’ll use as an example two use cases (which by the way are where we detected the issue)
- Compilation of the project.
I want the user to be able to compile the project on its machine (so build system = deployment system). Of course I can document that he has to explicitly pass the variable to cmake, but it does not seem too user friendly to me
- Brew formula.
I have to use ruby to detect the user platform and configure the arguments to cmake accordingly.
I also want to add that this issue arose with Xcode 7. Indeed Apple ships now (first the first time) only the 10.11 SDK, even if the system is 10.10. And this is what is causing the issue, because cmake automatically set the deployment target to match the sdk and not the build system. The compiled applications are not executable by the system then.
Hope I clarified :)
Ciao
Francesco
> On 05 Oct 2015, at 17:27, Brad King <brad.king at kitware.com> wrote:
>
> On 10/03/2015 05:00 AM, Francesco Romano wrote:
>> I don't know if this is the right mailing list
>
> This is a good place since it concerns a new OS X release.
>
>> I needed to set the variable `CMAKE_OSX_DEPLOYMENT_TARGET` to 10.10 and this
>> was done after the first "project" call.
>
> That should be right, though I cannot say for sure without seeing the code.
> Typically we do not have the project code set this value but instead add
> it to the CMake command line when building for deployment:
>
> -DCMAKE_OSX_DEPLOYMENT_TARGET=10.10
>
>> elseif("${CMAKE_GENERATOR}" MATCHES Xcode
>> OR CMAKE_OSX_DEPLOYMENT_TARGET
>> OR CMAKE_OSX_ARCHITECTURES MATCHES "[^;]"
>> OR NOT EXISTS "/usr/include/sys/types.h")
>>
>> Now, the question is: why the Unix Makefile should not need the
>> variable "CMAKE_OSX_SYSROOT" but only if the deployment target is not set?
>> Shouldn't be correct to set anyway the sysroot (which by the way can be
>> easily found because Xcode is present on the machine)?
>
> The Unix Makefiles generator also supports the Xcode command-line tools,
> third-party compilers, etc. that all build for the host system. If you
> are explicitly building for deployment then you should specify
>
> -DCMAKE_OSX_SYSROOT=/path/to/10.10/SDK
>
> The Xcode generator searches for a sysroot even when not using an
> explicit deployment target because Xcode always wants one specified
> and does not support the pure command-line tools.
>
> -Brad
>
More information about the cmake-developers
mailing list