]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
reorganize OS detection
authorKonstantinos Margaritis <konstantinos@vectorcamp.gr>
Wed, 20 Dec 2023 15:16:45 +0000 (17:16 +0200)
committerKonstantinos Margaritis <konstantinos@vectorcamp.gr>
Wed, 20 Dec 2023 15:16:45 +0000 (17:16 +0200)
cmake/osdetection.cmake

index 235487a9923bd0820b1e714697523812ea2ee1d7..343e16b50c6c7ab18c4ae19bd97b1cffdbc1768a 100644 (file)
@@ -7,28 +7,28 @@ if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
 endif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
 
 option(FAT_RUNTIME "Build a library that supports multiple microarchitectures" OFF)
-message("Checking Fat Runtime Requirements...")
-if (FAT_RUNTIME AND NOT LINUX)
-    message(FATAL_ERROR "Fat runtime is only supported on Linux OS")
-endif()
-
-if (USE_CPU_NATIVE AND FAT_RUNTIME)
-    message(FATAL_ERROR "Fat runtime is not compatible with Native CPU detection")
-endif()
-
-if (FAT_RUNTIME AND LINUX)
-    if (NOT (ARCH_IA32 OR ARCH_X86_64 OR ARCH_AARCH64))
-        message(FATAL_ERROR "Fat runtime is only supported on Intel and Aarch64 architectures")
+if (FAT_RUNTIME)
+    message("Checking Fat Runtime Requirements...")
+    if (NOT LINUX)
+        message(FATAL_ERROR "Fat runtime is only supported on Linux OS")
     else()
-        message(STATUS "Building Fat runtime for multiple microarchitectures")
-       message(STATUS "generator is ${CMAKE_GENERATOR}")
-        if (NOT (CMAKE_GENERATOR MATCHES "Unix Makefiles" OR
-            (CMAKE_VERSION VERSION_GREATER "3.0" AND CMAKE_GENERATOR MATCHES "Ninja")))
-           message (FATAL_ERROR "Building the fat runtime requires the Unix Makefiles generator, or Ninja with CMake v3.0 or higher")
+        if (USE_CPU_NATIVE AND FAT_RUNTIME)
+            message(FATAL_ERROR "Fat runtime is not compatible with Native CPU detection")
+        endif()
+
+        if (NOT (ARCH_IA32 OR ARCH_X86_64 OR ARCH_AARCH64))
+            message(FATAL_ERROR "Fat runtime is only supported on Intel and Aarch64 architectures")
         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 "Building Fat runtime for multiple microarchitectures")
+            message(STATUS "generator is ${CMAKE_GENERATOR}")
+            if (NOT (CMAKE_GENERATOR MATCHES "Unix Makefiles" OR
+                (CMAKE_VERSION VERSION_GREATER "3.0" AND CMAKE_GENERATOR MATCHES "Ninja")))
+                message (FATAL_ERROR "Building the fat runtime requires the Unix Makefiles generator, or Ninja with CMake v3.0 or higher")
+            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")
+                endif()
             endif()
         endif()
     endif()
@@ -36,5 +36,3 @@ if (FAT_RUNTIME AND LINUX)
         message(FATAL_ERROR "Fat runtime is only built on Release builds")
     endif()
 endif ()
-
-