[Piglit] [PATCH] cmake: Avoid depending on MinGW runtime DLLs.
Brian Paul
brianp at vmware.com
Fri Mar 9 09:12:16 PST 2012
On 03/09/2012 10:02 AM, jfonseca at vmware.com wrote:
> From: José Fonseca<jfonseca at vmware.com>
>
> It makes the binaries easier to deploy.
> ---
> CMakeLists.txt | 16 ++++++++++++++++
> 1 files changed, 16 insertions(+), 0 deletions(-)
>
> diff --git a/CMakeLists.txt b/CMakeLists.txt
> index 47c8b3f..3d7bf35 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -94,6 +94,22 @@ else ()
> add_definitions (-D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
> endif ()
>
> +if (MINGW)
> + # Avoid depending on MinGW runtime DLLs
> + check_cxx_compiler_flag (-static-libgcc HAVE_STATIC_LIBGCC_FLAG)
> + if (HAVE_STATIC_LIBGCC_FLAG)
> + set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc")
> + set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libgcc")
> + set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -static-libgcc")
> + endif ()
> + check_cxx_compiler_flag (-static-libstdc++ HAVE_STATIC_LIBSTDCXX_FLAG)
> + if (HAVE_STATIC_LIBSTDCXX_FLAG)
> + set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++")
> + set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libstdc++")
> + set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -static-libstdc++")
> + endif ()
> +endif ()
> +
> if (WIN32)
> # MSVC& MinGW only define& use APIENTRY
> add_definitions (-DGLAPIENTRY=__stdcall)
This solves my problem. Thanks!
Tested-by: Brian Paul <brianp at vmware.com>
-Brian
More information about the Piglit
mailing list