--- CMakeLists.txt.orig	2021-12-03 19:59:40 UTC
+++ CMakeLists.txt
@@ -14,33 +14,7 @@ endif()
 project(chiapos C CXX ASM)
 
 # CMake 3.14+
-include(FetchContent)
 
-if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
-include(${CMAKE_INSTALL_PREFIX}/share/cmake/pybind11/pybind11Config.cmake)
-else()
-FetchContent_Declare(
-  pybind11-src
-  GIT_REPOSITORY https://github.com/pybind/pybind11.git
-  GIT_TAG        v2.7.1
-)
-FetchContent_MakeAvailable(pybind11-src)
-endif()
-
-FetchContent_Declare(
-  cxxopts
-  GIT_REPOSITORY https://github.com/jarro2783/cxxopts.git
-  GIT_TAG        v2.2.1
-)
-FetchContent_MakeAvailable(cxxopts)
-
-FetchContent_Declare(
-  gulrak
-  GIT_REPOSITORY https://github.com/gulrak/filesystem.git
-  GIT_TAG        v1.5.6
-)
-FetchContent_MakeAvailable(gulrak)
-
 set(FSE_LIB ${CMAKE_CURRENT_SOURCE_DIR}/lib/FiniteStateEntropy/lib)
 set(FSE_FILES
     ${FSE_LIB}/fse_compress.c
@@ -51,9 +25,10 @@ set(FSE_FILES
 
 include_directories(
   ${INCLUDE_DIRECTORIES}
+  ${CMAKE_INSTALL_PREFIX}/include
   ${CMAKE_CURRENT_SOURCE_DIR}/../lib/include
-  ${cxxopts_SOURCE_DIR}/include
-  ${gulrak_SOURCE_DIR}/include/ghc
+  ${CMAKE_CURRENT_SOURCE_DIR}/src-ext/cxxopts/include
+  ${CMAKE_CURRENT_SOURCE_DIR}/src-ext/gulrak/include/ghc
   ${CMAKE_CURRENT_SOURCE_DIR}/../lib/FiniteStateEntropy/lib
   ${CMAKE_CURRENT_SOURCE_DIR}/src
   ${CMAKE_CURRENT_SOURCE_DIR}/test
@@ -134,8 +109,6 @@ set(BLAKE3_SRC
 )
 ENDIF()
 
-pybind11_add_module(chiapos ${CMAKE_CURRENT_SOURCE_DIR}/python-bindings/chiapos.cpp src/chacha8.c ${BLAKE3_SRC})
-
 add_executable(ProofOfSpace
     src/cli.cpp
     src/chacha8.c
@@ -148,13 +121,6 @@ IF (BUILD_PROOF_OF_SPACE_STATICALLY)
   target_link_libraries(ProofOfSpace -static -Wl,--whole-archive -lrt -lpthread -Wl,--no-whole-archive)
 ENDIF()
 
-FetchContent_Declare(
-  Catch2
-  GIT_REPOSITORY https://github.com/catchorg/Catch2.git
-  GIT_TAG        v2.13.7
-)
-FetchContent_MakeAvailable(Catch2)
-
 add_executable(RunTests
     tests/test-main.cpp
     tests/test.cpp
@@ -166,18 +132,20 @@ target_link_libraries(RunTests
   PRIVATE
     fse
     Threads::Threads
-    Catch2::Catch2
 )
 
+install(TARGETS ProofOfSpace DESTINATION bin)
+install(TARGETS RunTests DESTINATION bin)
+
 find_package(Threads REQUIRED)
 
 add_library(uint128 STATIC uint128_t/uint128_t.cpp)
 target_include_directories(uint128 PUBLIC uint128_t)
 
 target_compile_features(fse PUBLIC cxx_std_17)
-target_compile_features(chiapos PUBLIC cxx_std_17)
 target_compile_features(RunTests PUBLIC cxx_std_17)
 
+
 if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
   target_link_libraries(chiapos PRIVATE fse Threads::Threads)
   target_link_libraries(ProofOfSpace fse Threads::Threads)
@@ -185,8 +153,8 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
   target_link_libraries(chiapos PRIVATE fse Threads::Threads)
   target_link_libraries(ProofOfSpace fse Threads::Threads)
 elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
-  target_link_libraries(chiapos PRIVATE fse Threads::Threads)
   target_link_libraries(ProofOfSpace fse Threads::Threads)
+  include(${CMAKE_INSTALL_PREFIX}/lib/cmake/Catch2/Catch.cmake)
 elseif (MSVC)
   target_link_libraries(chiapos PRIVATE fse Threads::Threads uint128)
   target_link_libraries(ProofOfSpace fse Threads::Threads uint128)
