[Mesa-dev] [PATCH 41/48] meson: Fix gtest linkage on msvc

Jon Turney jon.turney at dronecode.org.uk
Fri Jun 15 16:51:31 UTC 2018


On 11/06/2018 23:56, Dylan Baker wrote:
> We need to add an extra flag (/SUBSYSTEM:CONSOLE) to get the msvc linker
> to find main() in a static library.
> ---
>   src/gtest/meson.build | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/src/gtest/meson.build b/src/gtest/meson.build
> index 91a49240416..ed0d6974bd3 100644
> --- a/src/gtest/meson.build
> +++ b/src/gtest/meson.build
> @@ -25,7 +25,14 @@ libgtest = static_library(
>     build_by_default : false,
>   )
>   
> +_gtest_link_args = []
> +if cpp.get_id() == 'msvc'
> +  # required to use main() from a static library
> +  _gtest_link_args += '/SUBSYSTEM:CONSOLE'
> +endif

I think this is perhaps working around a meson bug

(This linker setting should be implied by executable(gui_app:false), but 
I don't think that is the case for msvc with ninja backend.  See 
https://github.com/mesonbuild/meson/pull/1794)

The rest of the series looks ok to me, but it's not stuff I actually use.


More information about the mesa-dev mailing list