Patch subprojects to use guix builds instead

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 62b99d1..c1ac38a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -98,7 +98,7 @@ else()
 endif()
 
 find_package(Threads)
-add_subdirectory(third_party/spdlog EXCLUDE_FROM_ALL)
+find_package( spdlog)
 
 set(PRIVATE_INCLUDE_DIRECTORIES
   ${CMAKE_CURRENT_SOURCE_DIR}/src
@@ -249,9 +249,10 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64)|(amd64)|(AMD64)")
   set(BUILD_SHARED_LIBS_SAVED "${BUILD_SHARED_LIBS}")
   set(BUILD_SHARED_LIBS OFF)
   set(BUILD_TESTING OFF)
-  add_subdirectory(third_party/cpu_features EXCLUDE_FROM_ALL)
+  find_package( CpuFeatures)
   set(BUILD_SHARED_LIBS "${BUILD_SHARED_LIBS_SAVED}")
-  list(APPEND LIBRARIES cpu_features)
+  find_library( CPU_FEATURES_LIBRARIES cpu_features)
+  list(APPEND LIBRARIES ${CPU_FEATURES_LIBRARIES})
 endif()
 
 if(ENABLE_CPU_DISPATCH)
@@ -349,8 +350,8 @@ if(WITH_MKL)
   else()
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64")
     set(MKL_LIBRARIES
-      ${MKL_LIBRARY_DIR}/libmkl_core.a
-      ${MKL_LIBRARY_DIR}/libmkl_intel_ilp64.a
+      ${MKL_LIBRARY_DIR}/libmkl_core.so
+      ${MKL_LIBRARY_DIR}/libmkl_intel_ilp64.so
       )
   endif()
 
@@ -358,19 +359,19 @@ if(WITH_MKL)
     if(WIN32)
       list(APPEND MKL_LIBRARIES ${MKL_LIBRARY_DIR}/mkl_intel_thread.lib)
     else()
-      list(APPEND MKL_LIBRARIES ${MKL_LIBRARY_DIR}/libmkl_intel_thread.a)
+      list(APPEND MKL_LIBRARIES ${MKL_LIBRARY_DIR}/libmkl_intel_thread.so)
     endif()
   elseif(OPENMP_RUNTIME STREQUAL "COMP")
     if(WIN32)
       message(FATAL_ERROR "Building with MKL requires Intel OpenMP")
     else()
-      list(APPEND MKL_LIBRARIES ${MKL_LIBRARY_DIR}/libmkl_gnu_thread.a)
+      list(APPEND MKL_LIBRARIES ${MKL_LIBRARY_DIR}/libmkl_gnu_thread.so)
     endif()
   elseif(OPENMP_RUNTIME STREQUAL "NONE")
     if(WIN32)
       list(APPEND MKL_LIBRARIES ${MKL_LIBRARY_DIR}/mkl_sequential.lib)
     else()
-      list(APPEND MKL_LIBRARIES ${MKL_LIBRARY_DIR}/libmkl_sequential.a)
+      list(APPEND MKL_LIBRARIES ${MKL_LIBRARY_DIR}/libmkl_sequential.so)
     endif()
   endif()
   list(APPEND PRIVATE_INCLUDE_DIRECTORIES ${MKL_INCLUDE_DIR})
@@ -439,6 +440,7 @@ if (WITH_RUY)
   add_definitions(-DCT2_WITH_RUY)
   set(CMAKE_POSITION_INDEPENDENT_CODE ON)
   set(CPUINFO_LIBRARY_TYPE static CACHE STRING "cpuinfo library type")
+  # if package found and appended to libraries, issue with linking
   add_subdirectory(third_party/ruy EXCLUDE_FROM_ALL)
   unset(CMAKE_POSITION_INDEPENDENT_CODE)
   list(APPEND LIBRARIES ruy)
diff --git a/cli/CMakeLists.txt b/cli/CMakeLists.txt
index 3311ad3..7d90693 100644
--- a/cli/CMakeLists.txt
+++ b/cli/CMakeLists.txt
@@ -1,14 +1,12 @@
-if (NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../third_party/cxxopts/include")
-  message(FATAL_ERROR "The client dependency repository (cxxopts) is missing! "
-    "You probably didn't clone the project with --recursive. You can include it "
-    "by calling \"git submodule update --init --recursive\"")
-endif()
-
 add_executable(translator
   translator.cc
   )
+find_path(
+  CXXOPTS_ROOT
+  include/cxxopts.hpp
+)
 target_include_directories(translator
-  PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../third_party/cxxopts/include
+  PRIVATE ${CXXOPTS_ROOT}/include
   )
 target_link_libraries(translator
   PRIVATE ${PROJECT_NAME}
diff --git a/src/cpu/cpu_info.cc b/src/cpu/cpu_info.cc
index 9030ac7..6949644 100644
--- a/src/cpu/cpu_info.cc
+++ b/src/cpu/cpu_info.cc
@@ -4,7 +4,7 @@
 
 #include <cstring>
 
-#include <cpuinfo_x86.h>
+#include <cpu_features/cpuinfo_x86.h>
 
 namespace ctranslate2 {
   namespace cpu {
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 283c49d..9ca6cc8 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -2,7 +2,7 @@ enable_testing()
 
 option(BUILD_GMOCK "" OFF)
 option(INSTALL_GTEST "" OFF)
-add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../third_party/googletest ${CMAKE_CURRENT_BINARY_DIR}/googletest)
+find_package( GTest)
 
 add_executable(ctranslate2_test
   batching_test.cc
@@ -20,7 +20,7 @@ target_include_directories(ctranslate2_test PRIVATE
   )
 target_link_libraries(ctranslate2_test
   ${PROJECT_NAME}
-  gtest_main
+  gtest
   )
 
 add_executable(benchmark_ops
