From 9199f7c627dffa729f4c1cb771c465c86ed16933 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 14 Dec 2009 17:47:14 -0500 Subject: [PATCH] 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. --- CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ec318082c..b4d6c5c6a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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