diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake index 1b6604deef..b0f7558ceb 100644 --- a/build/cmake/init.cmake +++ b/build/cmake/init.cmake @@ -36,11 +36,17 @@ if(MSVC) "Flags used by the CXX compiler during ${cfg_upper} builds." FORCE) endif() endforeach() -endif() - -if(wxBUILD_MSVC_MULTIPROC) - wx_string_append(CMAKE_C_FLAGS " /MP") - wx_string_append(CMAKE_CXX_FLAGS " /MP") + + if(wxBUILD_MSVC_MULTIPROC) + wx_string_append(CMAKE_C_FLAGS " /MP") + wx_string_append(CMAKE_CXX_FLAGS " /MP") + endif() +elseif(CMAKE_COMPILER_IS_GNUCC) + if(wxBUILD_USE_STATIC_RUNTIME) + set(STATIC_LINKER_FLAGS " -static-libgcc -static-libstdc++") + wx_string_append(CMAKE_EXE_LINKER_FLAGS "${STATIC_LINKER_FLAGS}") + wx_string_append(CMAKE_SHARED_LINKER_FLAGS "${STATIC_LINKER_FLAGS}") + endif() endif() if(wxBUILD_COMPATIBILITY VERSION_LESS 3.0) diff --git a/build/cmake/options.cmake b/build/cmake/options.cmake index b7703811ac..70878a1803 100644 --- a/build/cmake/options.cmake +++ b/build/cmake/options.cmake @@ -26,8 +26,11 @@ mark_as_advanced(wxBUILD_CUSTOM_SETUP_HEADER_PATH) wx_option(wxBUILD_DEBUG_LEVEL "Debug Level" Default STRINGS Default 0 1 2) mark_as_advanced(wxBUILD_DEBUG_LEVEL) -if(MSVC) +if(MSVC OR CMAKE_COMPILER_IS_GNUCC) wx_option(wxBUILD_USE_STATIC_RUNTIME "Link using the static runtime library" OFF) +endif() + +if(MSVC) wx_option(wxBUILD_MSVC_MULTIPROC "Enable multi-processor compilation for MSVC") else() # Other compilers support setting the C++ standard, present it an option to the user