meson: Fix Windows build with PCRE2 as sibling subproject

If glib and PCRE2 are both built for Windows as subprojects of a parent
project, cc.links() will fail because PCRE2 hasn't been built yet when
glib is being configured:

    subprojects/glib-2.78.0/meson.build:2109:20: ERROR: Dependencies must be external dependencies

609d58beea changed the detection logic to avoid cc.links() in this
case, but dd5683ce64 broke it again.  PCRE2 detection could use a
broader cleanup, but for now, make the minimum change to fix this case.

use_pcre2_static_flag ends up set to false, matching the behavior of
609d58beea.

Fixes: dd5683ce64 ("meson: Allow fallback & static build of pcre subproject")
This commit is contained in:
Benjamin Gilbert 2023-10-01 18:26:02 -05:00
parent 722dba7ccf
commit 34e457e9f1

View File

@ -2105,7 +2105,7 @@ if not pcre2.found()
# static flags are automatically enabled by the subproject if it's built # static flags are automatically enabled by the subproject if it's built
# with default_library=static # with default_library=static
use_pcre2_static_flag = false use_pcre2_static_flag = false
elif host_system == 'windows' elif host_system == 'windows' and pcre2.type_name() != 'internal'
pcre2_static = cc.links('''#define PCRE2_STATIC pcre2_static = cc.links('''#define PCRE2_STATIC
#define PCRE2_CODE_UNIT_WIDTH 8 #define PCRE2_CODE_UNIT_WIDTH 8
#include <pcre2.h> #include <pcre2.h>