$NetBSD: patch-CMakeLists.txt,v 1.2 2021/04/05 11:58:57 tnn Exp $

Use devel/cpu_features from pkgsrc since the volk release tarball doesn't
bundle it and we need to patch cpu_features anyway.

--- CMakeLists.txt.orig	2020-12-17 15:49:06.000000000 +0000
+++ CMakeLists.txt
@@ -122,17 +122,8 @@ else()
   option(VOLK_CPU_FEATURES "Volk uses cpu_features" OFF)
 endif()
 if (VOLK_CPU_FEATURES)
-  if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/cpu_features/CMakeLists.txt" )
-    message(FATAL_ERROR "cpu_features/CMakeLists.txt not found. Did you forget to git clone recursively?\nFix with: git submodule update --init")
-  endif()
   message(STATUS "Building Volk with cpu_features")
-  set(BUILD_PIC ON CACHE BOOL
-    "Build cpu_features with Position Independent Code (PIC)."
-    FORCE)
-  set(BUILD_SHARED_LIBS_SAVED "${BUILD_SHARED_LIBS}")
-  set(BUILD_SHARED_LIBS OFF)
-  add_subdirectory(cpu_features)
-  set(BUILD_SHARED_LIBS "${BUILD_SHARED_LIBS_SAVED}")
+  find_package(CpuFeatures)
 else()
   message(STATUS "Building Volk without cpu_features")
 endif()
