Skip to content

Commit 34c798a

Browse files
committed
CMake: set OSX specific variables properly
On OSX 10.10, one gets errors of the type: [cmake] CMake Error at Modules/Platform/Darwin.cmake:76 (message): [cmake] CMAKE_OSX_DEPLOYMENT_TARGET is '10.10' but CMAKE_OSX_SYSROOT: [cmake] [cmake] "" [cmake] [cmake] is not set to a MacOSX SDK with a recognized version. Either set [cmake] CMAKE_OSX_SYSROOT to a valid SDK or set CMAKE_OSX_DEPLOYMENT_TARGET to [cmake] empty. [cmake] Call Stack (most recent call first): [cmake] Modules/CMakeSystemSpecificInformation.cmake:36 (include) [cmake] CMakeLists.txt:16 (project) Unless the CMAKE_OSX_DEPLOYMENT_TARGET is set to empty. We set it to empty by unsetting the MACOSX_DEPLOYMENT_TARGET environment variable. Similar problem happens when cmake is used to build other packages. There the fix is to unset the CMAKE_OSX_DEPLOYMENT_TARGET variable on the command line.
1 parent 835f05b commit 34c798a

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

base/cmake_package.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ def configure(ctx, stage_args):
3434
else:
3535
conf_lines.append('-DCMAKE_BUILD_TYPE:STRING=Release')
3636

37+
if ctx.parameters['platform'] == 'Darwin':
38+
conf_lines.append('-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=""')
39+
3740
#cmake needs to be given all the dependency dirs as prefix paths
3841
#so that we search the hashdist directories before the system directories
3942
#CMake doesn't use the CPPFLAGS implicitly to find libraries

pkgs/cmake.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ sources:
88
url: http://www.cmake.org/files/v3.2/cmake-3.2.2.tar.gz
99

1010
build_stages:
11+
- when: platform == 'Darwin'
12+
name: fix_deployment_target
13+
after: prologue
14+
before: configure
15+
handler: bash
16+
bash: |
17+
unset MACOSX_DEPLOYMENT_TARGET
18+
1119
- name: configure
1220
extra: ['--parallel=${HASHDIST_CPU_COUNT}',
1321
'--system-bzip2',

0 commit comments

Comments
 (0)