diff --git a/cmake/CheckDependencies.cmake b/cmake/CheckDependencies.cmake
index 8745af401aa8a26b792b701bf265a253e4cba517..a9007396d67b618a932aac51a371519fdce6d952 100644
--- a/cmake/CheckDependencies.cmake
+++ b/cmake/CheckDependencies.cmake
@@ -28,6 +28,7 @@ elseif(UNIX)
         libgcc_s
         libpthread
         libsvace
+        libstdc++
     )
 else()
     message(FATAL_ERROR "Unknown platform")
diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake
index 2030f690a76cf08ee974768c7b4df3dc460533fe..f76f953c867ecfbb6cd20e339e308d509c5f7394 100644
--- a/cmake/compiler.cmake
+++ b/cmake/compiler.cmake
@@ -167,10 +167,10 @@ endif()
 option(ENABLE_BUNDLED_LIBUNWIND "Bundled libunwind will be built"
        ${ENABLE_BUNDLED_LIBUNWIND_DEFAULT})
 
-# On macOS there is no '-static-libstdc++' flag and it's use will
-# raise following error:
-# error: argument unused during compilation: '-static-libstdc++'
-if(BUILD_STATIC AND NOT TARGET_OS_DARWIN)
+# In Clang there is no '-static-libstdc++' flag and its use will raise
+# the following error:
+#     clang: error: argument unused during compilation: '-static-libstdc++'
+if(BUILD_STATIC AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
     # Static linking for c++ routines
     add_compile_flags("C;CXX" "-static-libstdc++")
 endif()