add support for generating pure static binaries

fixes #282

Test: Build
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4a72f01..64eef32 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -156,6 +156,7 @@
   set(CMAKE_POSITION_INDEPENDENT_CODE ON)
   set(CMAKE_CXX_VISIBILITY_PRESET hidden)
   set(CMAKE_VISIBILITY_INLINES_HIDDEN YES)
+  set(UHDR_ENABLE_STATIC_LINKING OFF)
   add_compile_options(-DUHDR_BUILDING_SHARED_LIBRARY)
 else()
   if(WIN32)
@@ -163,6 +164,18 @@
   else()
     set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
   endif()
+  if(APPLE)
+    message(STATUS "Apple does not support statically linking an entire executable, disabling '-static' option")
+    set(UHDR_ENABLE_STATIC_LINKING OFF)
+  elseif(DEFINED UHDR_SANITIZE_OPTIONS OR UHDR_BUILD_FUZZERS)
+    message(STATUS "Possible that sanitizer libraries are only DSO's, disabling '-static' option")
+    set(UHDR_ENABLE_STATIC_LINKING OFF)
+  elseif(MSVC)
+    message(STATUS "Disabling '-static' option in MSVC platforms")
+    set(UHDR_ENABLE_STATIC_LINKING OFF)
+  else()
+    set(UHDR_ENABLE_STATIC_LINKING ON)
+  endif()
 endif()
 if(UHDR_ENABLE_LOGS)
   add_compile_options(-DLOG_NDEBUG)
@@ -548,6 +561,9 @@
   if(UHDR_BUILD_FUZZERS)
     target_link_options(ultrahdr_app PRIVATE -fsanitize=fuzzer-no-link)
   endif()
+  if(UHDR_ENABLE_STATIC_LINKING)
+    target_link_options(ultrahdr_app PRIVATE -static)
+  endif()
   target_link_libraries(ultrahdr_app PRIVATE ${UHDR_CORE_LIB_NAME})
 endif()