Skip to content

Commit

Permalink
COMP: Set apple build environment flags consistently in packages.
Browse files Browse the repository at this point in the history
  • Loading branch information
hjmjohnson committed Jun 5, 2024
1 parent 1aa76e1 commit 79e98d7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CMake/InitializeOSXVariables.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ if(APPLE)
if(NOT "${CMAKE_OSX_ARCHITECTURES}" STREQUAL "")
list(LENGTH CMAKE_OSX_ARCHITECTURES arch_count)
if(arch_count GREATER 1)
message(FATAL_ERROR "error: Only one value (i386 or x86_64) should be associated with CMAKE_OSX_ARCHITECTURES.")
message(FATAL_ERROR "error: Only one value (arm64, i386 or x86_64) should be associated with CMAKE_OSX_ARCHITECTURES.")
endif()
endif()

set(required_deployment_target "11.0")
if("x${CMAKE_OSX_DEPLOYMENT_TARGET}x" STREQUAL "xx")
set(CMAKE_OSX_DEPLOYMENT_TARGET ${required_deployment_target})
set(CMAKE_OSX_DEPLOYMENT_TARGET ${required_deployment_target} CACHE STRING "OSX Deployment target" FORCE)
endif()

if(CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS ${required_deployment_target})
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ if(APPLE)
# Note: By setting CMAKE_OSX_* variables before any enable_language() or project() calls,
# we ensure that the bitness, and C++ standard library will be properly detected.
include(InitializeOSXVariables)
if(NOT CMAKE_OSX_DEPLOYMENT_TARGET EQUAL "11.0")
message(FATAL_ERROR "FAILURE ${CMAKE_OSX_DEPLOYMENT_TARGET} != 11.0")
endif()
endif()

#-----------------------------------------------------------------------------
Expand Down
12 changes: 12 additions & 0 deletions Common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -605,13 +605,25 @@ if(NOT Slicer_BUILD_BRAINSTOOLS)
)
endif()

if(APPLE)
set(APPLE_CONFIGURATION_DEFAULTS
-DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES}
-DCMAKE_OSX_SYSROOT:PATH=${CMAKE_OSX_SYSROOT}
-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=${CMAKE_OSX_DEPLOYMENT_TARGET}
-DCMAKE_MACOSX_RPATH:BOOL=${CMAKE_MACOSX_RPATH}
)
else()
unset(APPLE_CONFIGURATION_DEFAULTS)
endif()

set( EXTERNAL_PROJECT_DEFAULTS
-DCMAKE_BUILD_TYPE:STRING=${EXTERNAL_PROJECT_BUILD_TYPE}
-DBUILD_EXAMPLES:BOOL=OFF
-DBUILD_TESTING:BOOL=OFF
#-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_BINARY_DIR}/${proj}-install
-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
-DBUILD_SHARED_LIBS:BOOL=${EXTERNAL_BUILD_SHARED_LIBS}
${APPLE_CONFIGURATION_DEFAULTS}
)


Expand Down

0 comments on commit 79e98d7

Please sign in to comment.