summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeDetermineCompilerId.cmake
diff options
context:
space:
mode:
authorMaikel van den Hurk <maikel.vandenhurk@tomtom.com>2018-12-10 06:24:53 (GMT)
committerBrad King <brad.king@kitware.com>2018-12-10 19:41:42 (GMT)
commitc86e82c09299211c76366640dd0f21a6d5acc9e8 (patch)
tree1afcd9fcc574fe2e96f4a82ee0043556be6e2f21 /Modules/CMakeDetermineCompilerId.cmake
parent4b513c0ca31d5a90b283b794397e40168070e400 (diff)
downloadCMake-c86e82c09299211c76366640dd0f21a6d5acc9e8.zip
CMake-c86e82c09299211c76366640dd0f21a6d5acc9e8.tar.gz
CMake-c86e82c09299211c76366640dd0f21a6d5acc9e8.tar.bz2
Add Mach-O CMAKE_EXECUTABLE_FORMAT detection
Code for this was prototyped when ELF detection was added long ago but left commented out. Use either MH_MAGIC or MH_CIGAM for the 32-bit variant and use either or MH_MAGIC_64 or MH_CIGAM_64 for the 64-bit variant.
Diffstat (limited to 'Modules/CMakeDetermineCompilerId.cmake')
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake11
1 files changed, 4 insertions, 7 deletions
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 5e2df26a..050d3e7 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -659,13 +659,10 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
# set(CMAKE_EXECUTABLE_FORMAT "COFF" CACHE STRING "Executable file format")
# endif()
#
-# # Mach-O files start with CAFEBABE or FEEDFACE, according to http://radio.weblogs.com/0100490/2003/01/28.html
-# if("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "cafebabe")
-# set(CMAKE_EXECUTABLE_FORMAT "MACHO" CACHE STRING "Executable file format")
-# endif()
-# if("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "feedface")
-# set(CMAKE_EXECUTABLE_FORMAT "MACHO" CACHE STRING "Executable file format")
-# endif()
+ # Mach-O files start with MH_MAGIC or MH_CIGAM
+ if("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "feedface|cefaedfe|feedfacf|cffaedfe")
+ set(CMAKE_EXECUTABLE_FORMAT "MACHO" CACHE STRING "Executable file format")
+ endif()
endif()
if(NOT DEFINED CMAKE_EXECUTABLE_FORMAT)