@@ -39,7 +39,6 @@ if(CMAKE_SYSTEM_NAME MATCHES "Android")
39
39
# Mac Catalyst build is the only scenario we have where the target system name
40
40
# is Darwin.
41
41
elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin" )
42
- set (PCRE2_TARGET --target pcre2-8-static )
43
42
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -target x86_64-apple-ios-macabi" )
44
43
set (
45
44
EXTRA_BUILD_ARGS
@@ -55,7 +54,6 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "iOS")
55
54
-DCMAKE_IOS_INSTALL_COMBINED=${CMAKE_IOS_INSTALL_COMBINED}
56
55
-GXcode
57
56
)
58
- set (PCRE2_TARGET --target pcre2-8-static )
59
57
endif ()
60
58
61
59
if (CMAKE_SYSTEM_NAME MATCHES "Android|Windows" )
@@ -76,20 +74,14 @@ execute_process(
76
74
execute_process (
77
75
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} /pcre2
78
76
--config Release
79
- ${PCRE2_TARGET}
80
- )
81
-
82
- if (
83
- NOT CMAKE_SYSTEM_NAME MATCHES "iOS"
84
77
85
- # TODO: We wanna say "and not Mac Catalyst build", for which the current
86
- # condition is not specific enough, but will do for now, as Mac Catalyst
87
- # build is the only scenario we gonna have Darwin as the target platform
88
- # as of now.
89
- AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin"
78
+ # This allows to not sign compiled PCRE2 executables for iOS / macOS builds,
79
+ # we don't really use them anyway, but we need them build for the install
80
+ # command below to work.
81
+ -- CODE_SIGNING_ALLOWED=NO
90
82
)
91
- execute_process ( COMMAND ${CMAKE_COMMAND} --install ${CMAKE_BINARY_DIR} /pcre2 )
92
- endif ( )
83
+
84
+ execute_process ( COMMAND ${CMAKE_COMMAND} --install ${CMAKE_BINARY_DIR} /pcre2 )
93
85
94
86
# Copies shared PCRE2 library into the folder from where Gradle automatically
95
87
# will bundle it in the host app package.
@@ -104,21 +96,13 @@ if(CMAKE_SYSTEM_NAME MATCHES "Android|Windows")
104
96
set (BUILD_SHARED_LIBS 1 )
105
97
endif ()
106
98
107
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPCRE2_CODE_UNIT_WIDTH=8 -I${CMAKE_BINARY_DIR} /sysroot/include -L${CMAKE_BINARY_DIR} /sysroot/lib" )
108
-
109
- # To find PCRE2 Lighttpd first of all tries to use pkg_check_modules().
110
- # It seems that on Linux it ends up relying on pkg-config utility of the host
111
- # system, which find the host's version of PCRE2. With CMake 3.18.1 it was fine,
112
- # as it used to output the linker flag for PCRE2 just as "-lpcre2-8",
113
- # and just above we set the correct -L flag with the path of PCRE2
114
- # cross-compiled for Android. However, with CMake 3.22.1 the CMake's default
115
- # output is "-L/usr/lib/x86_64-linux-gnu;-lpcre2-8", which ends up forcing
116
- # Lighttpd to try linking against the host's PCRE2, which fails. The flag set
117
- # below instructs pkg-config to not include -L flag into outputs,
118
- # thus restoring the correct linking. However, it is not the best fix,
119
- # I guess.
120
- # TODO: Find a better fix.
121
- set (PKG_CONFIG_ARGN --libs-only-l )
99
+ # These enforce pkg_check_modules(), find_program(), etc. in Lighttpd CMake
100
+ # config to look for local build of PCRE2 in the location it was installed to.
101
+ set (CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR} /sysroot" )
102
+
103
+ # TODO: Not sure now, whether this is needed, or already covered by the variable
104
+ # above.
105
+ set (CMAKE_FIND_ROOT_PATH "${CMAKE_BINARY_DIR} /sysroot" )
122
106
123
107
add_subdirectory (lighttpd1.4 )
124
108
0 commit comments