]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
cmake: check clang version for fat runtime support
authorMatthew Barr <matthew.barr@intel.com>
Mon, 12 Dec 2016 05:42:32 +0000 (16:42 +1100)
committerMatthew Barr <matthew.barr@intel.com>
Wed, 14 Dec 2016 04:35:44 +0000 (15:35 +1100)
CMakeLists.txt

index 8a4864f4453ca16808d76b5e80bef5104653807e..61eb9893a3b075c86254729b9c37dee8f07df26e 100644 (file)
@@ -258,13 +258,20 @@ endif()
 if (CMAKE_SYSTEM_NAME MATCHES "Linux")
     # This is a Linux-only feature for now - requires platform support
     # elsewhere
-    option(FAT_RUNTIME "Build a library that supports multiple microarchitecures" ${RELEASE_BUILD})
-    if (FAT_RUNTIME)
+    if (CMAKE_C_COMPILER_ID MATCHES "Clang" AND
+        CMAKE_C_COMPILER_VERSION VERSION_LESS "3.9")
+        message (STATUS "Clang v3.9 or higher required for fat runtime, cannot build fat runtime")
+        set (FAT_RUNTIME_REQUISITES FALSE)
+    else ()
         include (${CMAKE_MODULE_PATH}/attrib.cmake)
         if (NOT HAS_C_ATTR_IFUNC)
-            message(FATAL_ERROR "Compiler does not support ifunc attribute, cannot build fat runtime")
+            message(STATUS "Compiler does not support ifunc attribute, cannot build fat runtime")
+            set (FAT_RUNTIME_REQUISITES FALSE)
+        else ()
+            set (FAT_RUNTIME_REQUISITES TRUE)
         endif()
     endif()
+    CMAKE_DEPENDENT_OPTION(FAT_RUNTIME "Build a library that supports multiple microarchitecures" ${RELEASE_BUILD} "FAT_RUNTIME_REQUISITES" OFF)
 endif ()
 
 include (${CMAKE_MODULE_PATH}/arch.cmake)