summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-12-14 22:47:14 (GMT)
committerBrad King <brad.king@kitware.com>2009-12-14 22:47:14 (GMT)
commit9199f7c627dffa729f4c1cb771c465c86ed16933 (patch)
tree6b4080b883645405b3eeaa0f0fd2eb1e0316df10 /CMakeLists.txt
parent19839e96f61f215fb0f5de2a3d752bb0661fb1f1 (diff)
downloadCMake-9199f7c627dffa729f4c1cb771c465c86ed16933.zip
CMake-9199f7c627dffa729f4c1cb771c465c86ed16933.tar.gz
CMake-9199f7c627dffa729f4c1cb771c465c86ed16933.tar.bz2
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.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt11
1 files changed, 11 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ec31808..b4d6c5c 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