Commit 4e4c0e16 authored by jcfr's avatar jcfr

COMP: Make sure CMAKE_OSX_* variables are set before project() or enable_language() calls.

* By setting CMAKE_OSX_* variables before any enable_language() or project() calls,
we ensure that the bitness will be properly detected.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@17205 3bd1e089-480b-0410-8dfb-8563597acbee
parent b1a69d57
################################################################################
#
# Program: 3D Slicer
#
# Copyright (c) 2010 Kitware Inc.
#
# See Doc/copyright/copyright.txt
# or http://www.slicer.org/copyright/copyright.txt for details.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This file was originally developed by Jean-Christophe Fillion-Robin, Kitware Inc.
# and was partially funded by NIH grant 3P41RR013218-12S1
#
################################################################################
#
# SlicerBlockSetCMakeOSXVariables
#
#
# Adapted from Paraview/Superbuild/CMakeLists.txt
#
# Note: Change architecture *before* any enable_language() or project()
# calls so that it's set properly to detect 64-bit-ness...
# Currently, we default to 10.5. Obviously this may need to be re-evaluated when Lion comes out.
#
if(APPLE)
if(NOT CMAKE_OSX_DEPLOYMENT_TARGET OR "${CMAKE_OSX_DEPLOYMENT_TARGET}" STREQUAL "")
set(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "force build for 64-bit Leopard" FORCE)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.5" CACHE STRING "force build for 64-bit Leopard" FORCE)
set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.5.sdk" CACHE PATH "force build for 64-bit Leopard" FORCE)
endif()
if(NOT "${CMAKE_OSX_SYSROOT}" STREQUAL "")
if(NOT EXISTS "${CMAKE_OSX_SYSROOT}")
message(FATAL_ERROR "error: CMAKE_OSX_SYSROOT='${CMAKE_OSX_SYSROOT}' does not exist")
endif()
endif()
endif()
......@@ -2,6 +2,12 @@
cmake_minimum_required(VERSION 2.8.2)
#-----------------------------------------------------------------------------
if(APPLE)
# Note: By setting CMAKE_OSX_* variables before any enable_language() or project() calls,
# we ensure that the bitness will be properly detected.
include(${CMAKE_SOURCE_DIR}/CMake/SlicerBlockSetCMakeOSXVariables.cmake)
endif()
project(Slicer)
#-----------------------------------------------------------------------------
......
......@@ -23,6 +23,13 @@ if(NOT Slicer_SOURCE_DIR)
set(EXTENSION_DESCRIPTION "This is an example of Qt loadable module built as an extension")
find_package(Slicer REQUIRED)
if(APPLE)
# Note: By setting CMAKE_OSX_* variables before any enable_language() or project() calls,
# we ensure that the bitness will be properly detected.
include(${Slicer_CMAKE_DIR}/SlicerBlockSetCMakeOSXVariables.cmake)
endif()
project(${EXTENSION_NAME})
set(ADDITIONAL_C_FLAGS "" CACHE STRING "Additional ${EXTENSION_NAME} C Flags")
set(ADDITIONAL_CXX_FLAGS "" CACHE STRING "Additional ${EXTENSION_NAME} CXX Flags")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment