File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,17 +14,28 @@ endif()
1414
1515set (_target_name linuxdeploy-plugin-appimage)
1616
17+ # Clang does not support -static-libstdc++ and -static-libgcc, but just -static
18+ # is enough to link everything statically. We check for these flags and only
19+ # use them if they're supported.
20+ include (CheckCXXCompilerFlag )
21+ check_cxx_compiler_flag (-static-libstdc++ STATIC_LIBSTDCXX_SUPPORTED )
22+ check_cxx_compiler_flag (-static-libgcc STATIC_LIBGCC_SUPPORTED )
23+
1724# main executable
1825add_executable (${_target_name} main.cpp )
1926
2027target_link_libraries (${_target_name} args )
2128
2229set (_cflags
2330 -static
24- -static-libstdc++
25- -static-libgcc
2631 -flto
2732)
33+ if (STATIC_LIBSTDCXX_SUPPORTED)
34+ list (APPEND _cflags -static-libstdc++)
35+ endif ()
36+ if (STATIC_LIBGCC_SUPPORTED)
37+ list (APPEND _cflags -static-libgcc)
38+ endif ()
2839target_compile_options (${_target_name} PUBLIC ${_cflags} )
2940target_link_options (${_target_name} PUBLIC ${_cflags} )
3041
You can’t perform that action at this time.
0 commit comments