--- CMakeLists.txt.orig	2021-05-09 14:57:33 UTC
+++ CMakeLists.txt
@@ -170,6 +170,13 @@ set_target_properties(openshot-audio PROPERTIES
   EXPORT_NAME Audio  # Exports as OpenShot::Audio target
 )
 
+if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
+	find_package(Threads REQUIRED)
+	if(Threads_FOUND)
+		target_link_libraries(openshot-audio PRIVATE ${CMAKE_THREAD_LIBS_INIT})
+	endif(Threads_FOUND)
+endif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
+
 # Require language features we use
 if(CMAKE_VERSION VERSION_GREATER 3.8)
   target_compile_features(openshot-audio PUBLIC
@@ -188,7 +195,8 @@ endif()
 # Enable stack-unwinding support in c objects on gcc-based platforms.
 # Failing to do so will cause your program to be terminated when a png
 # or a jpeg exception is thrown on linux or macosx.
-if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR
+    CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
   target_compile_options(openshot-audio PRIVATE -fexceptions)
 endif()
 
@@ -249,8 +257,8 @@ if(UNIX AND NOT APPLE)
       INTERFACE_INCLUDE_DIRECTORIES ${ALSA_INCLUDE_DIR}
       INTERFACE_LINK_LIBRARIES ${ALSA_LIBRARIES})
   endif()
-  target_compile_definitions(openshot-audio PUBLIC LINUX)
-  target_link_libraries(openshot-audio PUBLIC ALSA::ALSA)
+  #target_compile_definitions(openshot-audio PUBLIC LINUX)
+  target_link_libraries(openshot-audio PRIVATE ALSA::ALSA)
 else()
   # For EXPORTED Config
   set(NEED_ALSA FALSE)
@@ -258,10 +266,24 @@ endif()
 
 # ZLIB -- uses IMPORTED target ZLIB::ZLIB which has existed since CMake 3.1
 find_package(ZLIB REQUIRED)
-target_link_libraries(openshot-audio PUBLIC ZLIB::ZLIB)
+target_link_libraries(openshot-audio PRIVATE ZLIB::ZLIB)
 
+# EXECINFO, SYSINFO
+if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
+	find_library(EXECINFO_LIBRARY NAMES execinfo)
+	if(NOT EXECINFO_LIBRARY)
+		message(FATAL_ERROR "${EXECINFO_LIBRARY}")
+	endif(NOT EXECINFO_LIBRARY)
+	target_link_libraries(openshot-audio PRIVATE ${EXECINFO_LIBRARY})
+	find_library(SYSINFO_LIBRARY NAMES sysinfo)
+	if(NOT SYSINFO_LIBRARY)
+		message(FATAL_ERROR "${SYSINFO_LIBRARY}")
+	endif(NOT SYSINFO_LIBRARY)
+	target_link_libraries(openshot-audio PRIVATE ${SYSINFO_LIBRARY})
+endif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
+
 # Link with dynamic loader for platform
-target_link_libraries(openshot-audio PUBLIC ${CMAKE_DL_LIBS})
+target_link_libraries(openshot-audio PRIVATE ${CMAKE_DL_LIBS})
 
 # Create an alias so our EXPORT target name works internally, as well
 add_library(OpenShot::Audio ALIAS openshot-audio)
