Add an option to static-link libgcc
Mainly just for MinGW to make OpenAL32.dll not rely on libgcc_s_sjlj-1.dll.
This commit is contained in:
@@ -304,6 +304,25 @@ ELSE()
|
||||
|
||||
CHECK_C_SOURCE_COMPILES("int foo() __attribute__((destructor));
|
||||
int main() {return 0;}" HAVE_GCC_DESTRUCTOR)
|
||||
|
||||
option(ALSOFT_STATIC_LIBGCC "Force -static-libgcc for static GCC runtimes" OFF)
|
||||
if(ALSOFT_STATIC_LIBGCC)
|
||||
set(OLD_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} -static-libgcc)
|
||||
check_c_source_compiles(
|
||||
"#include <stdlib.h>
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}"
|
||||
HAVE_STATIC_LIBGCC_SWITCH
|
||||
)
|
||||
if(HAVE_STATIC_LIBGCC_SWITCH)
|
||||
set(EXTRA_LIBS ${EXTRA_LIBS} -static-libgcc)
|
||||
endif()
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${OLD_REQUIRED_LIBRARIES})
|
||||
unset(OLD_REQUIRED_LIBRARIES)
|
||||
endif()
|
||||
ENDIF()
|
||||
|
||||
# Set visibility/export options if available
|
||||
|
||||
Reference in New Issue
Block a user