Disable arch-specific try_run in CMake itself

We disallow try_run() when CMAKE_TRY_COMPILE_OSX_ARCHITECTURES is set
because the binary might not be able to run on the host architecture.
This prevents us from creating ppc test binaries on i386 Mac machines
that cause Rosetta install dialogs to appear.
This commit is contained in:
Brad King 2009-12-14 17:47:14 -05:00
parent 19839e96f6
commit 9199f7c627
1 changed files with 11 additions and 0 deletions

View File

@ -29,6 +29,17 @@ IF(NOT ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.4)
INSTALL(CODE "SET(CMAKE_INSTALL_SELF_2_4 1)")
ENDIF()
IF("${CMake_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
# Disallow architecture-specific try_run. It may not run on the host.
MACRO(TRY_RUN)
IF(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES)
MESSAGE(FATAL_ERROR "TRY_RUN not allowed with CMAKE_TRY_COMPILE_OSX_ARCHITECTURES=[${CMAKE_TRY_COMPILE_OSX_ARCHITECTURES}]")
ELSE()
_TRY_RUN(${ARGV})
ENDIF()
ENDMACRO()
ENDIF()
#-----------------------------------------------------------------------
# a macro to deal with system libraries, implemented as a macro
# simply to improve readability of the main script