--- CMakeLists.txt.orig	2023-08-11 08:54:43.660987000 +0200
+++ CMakeLists.txt	2023-08-11 09:20:13.573939000 +0200
@@ -29,8 +29,8 @@ endif()
   set(ICINGA2_MASTER ON)
 endif()
 
-option(ICINGA2_WITH_MYSQL "Build the MySQL IDO module" ${ICINGA2_MASTER})
-option(ICINGA2_WITH_PGSQL "Build the PostgreSQL IDO module" ${ICINGA2_MASTER})
+option(ICINGA2_WITH_MYSQL "Build the MySQL IDO module" ON)
+option(ICINGA2_WITH_PGSQL "Build the PostgreSQL IDO module" ON)
 option(ICINGA2_WITH_CHECKER "Build the checker module" ON)
 option(ICINGA2_WITH_COMPAT "Build the compat module" ${ICINGA2_MASTER})
 option(ICINGA2_WITH_LIVESTATUS "Build the Livestatus module" ${ICINGA2_MASTER})
@@ -269,6 +269,12 @@ if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -pthread")
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -pthread")
   endif()
+endif()
+
+if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD.*")
+	set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lexecinfo")
+	set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lexecinfo")
+	set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} -lexecinfo")
 endif()
 
 include(CheckCXXCompilerFlag)
