--- CMakeLists.txt.orig	2023-02-06 15:09:28 UTC
+++ CMakeLists.txt
@@ -20,6 +20,8 @@ add_subdirectory(gtest EXCLUDE_FROM_ALL) # We don't wa
 project(leelaz)
 add_subdirectory(gtest EXCLUDE_FROM_ALL) # We don't want to install gtest, exclude it from `all`
 
+link_directories(${CMAKE_INSTALL_PREFIX}/lib)
+
 # Required Packages
 set(Boost_MIN_VERSION "1.58.0")
 set(Boost_USE_MULTITHREADED ON)
@@ -49,7 +51,7 @@ find_package(Qt5Core)
 endif()
 find_package(Qt5Core)
 
-set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_CXX_STANDARD 17)
 set(CMAKE_CXX_STANDARD_REQUIRED on)
 
 # See if we can set optimization flags as expected.
@@ -70,13 +72,13 @@ if(GccSpecificFlags)
 endif(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
 
 if(GccSpecificFlags)
-  set(GCC_COMPILE_FLAGS "-Wall -Wextra -ffast-math -flto -march=native")
+  set(GCC_COMPILE_FLAGS "-Wall -Wextra -ffast-math") # https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=238514
   set(GCC_DISABLED_WARNING_COMPILE_FLAGS "-Wno-ignored-attributes -Wno-maybe-uninitialized \
       -Wno-mismatched-tags")
   set(GCC_FLAGS "${GCC_COMPILE_FLAGS} ${GCC_DISABLED_WARNING_COMPILE_FLAGS}")
   set(CMAKE_CXX_FLAGS_DEBUG "${GCC_FLAGS} -g -Og")
   set(CMAKE_CXX_FLAGS_RELEASE "${GCC_FLAGS} -g -O3 -DNDEBUG")
-  set(CMAKE_EXE_LINKER_FLAGS "-flto -g")
+  set(CMAKE_EXE_LINKER_FLAGS "-g") # https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=238514
 endif(GccSpecificFlags)
 
 if(USE_CPU_ONLY)
@@ -86,7 +88,7 @@ endif()
   add_definitions(-DUSE_HALF)
 endif()
 
-set(IncludePath "${CMAKE_CURRENT_SOURCE_DIR}/src" "${CMAKE_CURRENT_SOURCE_DIR}/src/Eigen")
+set(IncludePath "${CMAKE_CURRENT_SOURCE_DIR}/src" "${CMAKE_INSTALL_PREFIX}/include/eigen3")
 set(SrcPath "${CMAKE_CURRENT_SOURCE_DIR}/src")
 
 include_directories(${IncludePath})
@@ -130,6 +132,7 @@ endif()
 endif()
 
 # Google Test below
+if (BUILD_TESTING)
 file(GLOB tests_SRC "${SrcPath}/tests/*.cpp")
 
 add_executable(tests ${tests_SRC} $<TARGET_OBJECTS:objs>)
@@ -142,6 +145,7 @@ target_link_libraries(tests gtest_main ${CMAKE_THREAD_
 target_link_libraries(tests ${OpenCL_LIBRARIES})
 target_link_libraries(tests ${ZLIB_LIBRARIES})
 target_link_libraries(tests gtest_main ${CMAKE_THREAD_LIBS_INIT})
+endif(BUILD_TESTING)
 
 include(GetGitRevisionDescription)
 git_describe(VERSION --tags)
