forked from facebook/hhvm
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHPHPFunctions.cmake
More file actions
531 lines (479 loc) · 17.1 KB
/
Copy pathHPHPFunctions.cmake
File metadata and controls
531 lines (479 loc) · 17.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
if (${CMAKE_MAJOR_VERSION} GREATER 2)
cmake_policy(SET CMP0026 OLD)
endif()
include(GNUInstallDirs)
function(auto_sources RETURN_VALUE PATTERN SOURCE_SUBDIRS)
if ("${SOURCE_SUBDIRS}" STREQUAL "RECURSE")
SET(PATH ".")
if (${ARGC} EQUAL 4)
list(GET ARGV 3 PATH)
endif ()
endif()
if ("${SOURCE_SUBDIRS}" STREQUAL "RECURSE")
unset(${RETURN_VALUE})
file(GLOB SUBDIR_FILES "${PATH}/${PATTERN}")
list(APPEND ${RETURN_VALUE} ${SUBDIR_FILES})
file(GLOB subdirs RELATIVE ${PATH} ${PATH}/*)
foreach(DIR ${subdirs})
if (IS_DIRECTORY ${PATH}/${DIR})
if (NOT "${DIR}" STREQUAL "CMakeFiles")
file(GLOB_RECURSE SUBDIR_FILES "${PATH}/${DIR}/${PATTERN}")
list(APPEND ${RETURN_VALUE} ${SUBDIR_FILES})
endif()
endif()
endforeach()
else ()
file(GLOB ${RETURN_VALUE} "${PATTERN}")
foreach (PATH ${SOURCE_SUBDIRS})
file(GLOB SUBDIR_FILES "${PATH}/${PATTERN}")
list(APPEND ${RETURN_VALUE} ${SUBDIR_FILES})
endforeach(PATH ${SOURCE_SUBDIRS})
endif ()
if (${FILTER_OUT})
list(REMOVE_ITEM ${RETURN_VALUE} ${FILTER_OUT})
endif()
set(${RETURN_VALUE} ${${RETURN_VALUE}} PARENT_SCOPE)
endfunction(auto_sources)
macro(HHVM_SELECT_SOURCES DIR)
auto_sources(files "*.cpp" "RECURSE" "${DIR}")
foreach(f ${files})
if (NOT (${f} MATCHES "(ext_hhvm|/(old-)?tests?/)"))
list(APPEND CXX_SOURCES ${f})
endif()
endforeach()
auto_sources(files "*.c" "RECURSE" "${DIR}")
foreach(f ${files})
if (NOT (${f} MATCHES "(ext_hhvm|/(old-)?tests?/)"))
list(APPEND C_SOURCES ${f})
endif()
endforeach()
auto_sources(files "*.S" "RECURSE" "${DIR}")
foreach(f ${files})
if (NOT (${f} MATCHES "(ext_hhvm|/(old-)?tests?/)"))
list(APPEND ASM_SOURCES ${f})
endif()
endforeach()
auto_sources(files "*.h" "RECURSE" "${DIR}")
foreach(f ${files})
if (NOT (${f} MATCHES "(/(old-)?tests?/)"))
list(APPEND HEADER_SOURCES ${f})
endif()
endforeach()
endmacro(HHVM_SELECT_SOURCES)
function(CONTAINS_STRING FILE SEARCH RETURN_VALUE)
file(STRINGS ${FILE} FILE_CONTENTS REGEX ".*${SEARCH}.*")
if (FILE_CONTENTS)
set(${RETURN_VALUE} True PARENT_SCOPE)
endif()
endfunction(CONTAINS_STRING)
macro(MYSQL_SOCKET_SEARCH)
execute_process(COMMAND mysql_config --socket OUTPUT_VARIABLE MYSQL_SOCK OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
if (NOT MYSQL_SOCK)
foreach (i
/var/run/mysqld/mysqld.sock
/var/tmp/mysql.sock
/var/run/mysql/mysql.sock
/var/lib/mysql/mysql.sock
/var/mysql/mysql.sock
/usr/local/mysql/var/mysql.sock
/Private/tmp/mysql.sock
/private/tmp/mysql.sock
/tmp/mysql.sock
)
if (EXISTS ${i})
set(MYSQL_SOCK ${i})
break()
endif()
endforeach()
endif()
if (MYSQL_SOCK)
set(MYSQL_UNIX_SOCK_ADDR ${MYSQL_SOCK} CACHE STRING "Path to MySQL Socket")
endif()
endmacro()
function(append_systemlib TARGET SOURCE SECTNAME)
if (APPLE)
set(${TARGET}_SLIBS ${${TARGET}_SLIBS} -Wl,-sectcreate,__text,${SECTNAME},${SOURCE} PARENT_SCOPE)
else()
set(${TARGET}_SLIBS ${${TARGET}_SLIBS} "--add-section" "${SECTNAME}=${SOURCE}" PARENT_SCOPE)
endif()
endfunction(append_systemlib)
function(embed_sections TARGET DEST)
add_custom_command(TARGET ${TARGET} PRE_BUILD
# OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/generated-compiler-id.txt"
# "${CMAKE_CURRENT_SOURCE_DIR}/generated-compiler-timestamp.txt"
# "${CMAKE_CURRENT_SOURCE_DIR}/generated-repo-schema-id.txt"
# "${CMAKE_CURRENT_SOURCE_DIR}/generated-build-id.txt"
COMMAND
"INSTALL_DIR=${CMAKE_BINARY_DIR}/hphp/util"
"SOURCE_ROOT=${CMAKE_SOURCE_DIR}"
"${HPHP_HOME}/hphp/hhvm/generate-buildinfo.sh"
WORKING_DIRECTORY "${HPHP_HOME}/hphp/util"
COMMENT "Generating Repo Schema ID and Compiler ID"
VERBATIM)
if (APPLE)
set(COMPILER_ID -Wl,-sectcreate,__text,"compiler_id","${CMAKE_BINARY_DIR}/hphp/util/generated-compiler-id.txt")
set(COMPILER_TIMESTAMP -Wl,-sectcreate,__text,"compiler_ts","${CMAKE_BINARY_DIR}/hphp/util/generated-compiler-timestamp.txt")
set(REPO_SCHEMA -Wl,-sectcreate,__text,"repo_schema_id","${CMAKE_BINARY_DIR}/hphp/util/generated-repo-schema-id.txt")
set(BUILD_ID -Wl,-sectcreate,__text,"build_id","${CMAKE_BINARY_DIR}/hphp/util/generated-build-id.txt")
target_link_libraries(${TARGET} ${${TARGET}_SLIBS} ${COMPILER_ID} ${COMPILER_TIMESTAMP} ${REPO_SCHEMA} ${BUILD_ID})
else()
add_custom_command(TARGET ${TARGET} POST_BUILD
COMMAND "objcopy"
ARGS "--add-section" "compiler_id=${CMAKE_BINARY_DIR}/hphp/util/generated-compiler-id.txt"
"--add-section" "compiler_ts=${CMAKE_BINARY_DIR}/hphp/util/generated-compiler-timestamp.txt"
"--add-section" "repo_schema_id=${CMAKE_BINARY_DIR}/hphp/util/generated-repo-schema-id.txt"
"--add-section" "build_id=${CMAKE_BINARY_DIR}/hphp/util/generated-build-id.txt"
${${TARGET}_SLIBS}
${DEST}
DEPENDS "${CMAKE_BINARY_DIR}/hphp/util/generated-compiler-id.txt"
"${CMAKE_BINARY_DIR}/hphp/util/generated-compiler-timestamp.txt"
"${CMAKE_BINARY_DIR}/hphp/util/generated-repo-schema-id.txt"
"${CMAKE_BINARY_DIR}/hphp/util/generated-build-id.txt"
COMMENT "Embedding php in ${TARGET}")
endif()
endfunction(embed_sections)
macro(embed_systemlib_byname TARGET SLIB)
get_filename_component(SLIB_FILENAME ${SLIB} "NAME")
set(SLIB_EXTNAME "/:${SLIB_FILENAME}")
string(MD5 SLIB_HASH_NAME ${SLIB_EXTNAME})
# Some platforms limit section names to 16 characters :(
string(SUBSTRING ${SLIB_HASH_NAME} 0 12 SLIB_HASH_NAME_SHORT)
append_systemlib(${TARGET} ${SLIB} "ext.${SLIB_HASH_NAME_SHORT}")
endmacro()
function(embed_all_systemlibs TARGET ROOT DEST)
add_dependencies(${TARGET} systemlib)
foreach(SLIB ${EXTENSION_SYSTEMLIB_SOURCES} ${EZC_SYSTEMLIB_SOURCES})
get_filename_component(SLIB_FILENAME ${SLIB} NAME)
file(RELATIVE_PATH SLIB_RELATIVE_PATH ${CMAKE_SOURCE_DIR} ${SLIB})
list(APPEND SLIB_RELATIVE_PATHS ${SLIB_RELATIVE_PATH})
list(
APPEND PRECOMPILED_SYSTEMLIB_FILES
${CMAKE_CURRENT_BINARY_DIR}/slib/${SLIB_FILENAME}.decls
${CMAKE_CURRENT_BINARY_DIR}/slib/${SLIB_FILENAME}.ue
)
endforeach()
add_custom_command(
TARGET ${TARGET} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/slib
COMMAND $<TARGET_FILE:hhvm> --compile-systemlib --input-dir ${CMAKE_SOURCE_DIR} --output-dir ${CMAKE_CURRENT_BINARY_DIR}/slib ${SLIB_RELATIVE_PATHS}
COMMENT "Precompiling systemlib files"
VERBATIM)
foreach(PRECOMPILED_SLIB ${PRECOMPILED_SYSTEMLIB_FILES})
get_filename_component(PRECOMPILED_SLIB_FILENAME ${PRECOMPILED_SLIB} NAME)
embed_systemlib_byname(${TARGET} ${PRECOMPILED_SLIB})
endforeach()
embed_sections(${TARGET} ${DEST})
endfunction(embed_all_systemlibs)
# Custom install function that doesn't relink, instead it uses chrpath to change it, if
# it's available, otherwise, it leaves the chrpath alone
function(HHVM_INSTALL TARGET DEST)
get_target_property(LOC ${TARGET} LOCATION)
get_target_property(TY ${TARGET} TYPE)
if (FOUND_CHRPATH)
get_target_property(RPATH ${TARGET} INSTALL_RPATH)
if (NOT RPATH STREQUAL "RPATH-NOTFOUND")
if (RPATH STREQUAL "")
install(CODE "execute_process(COMMAND \"${CHRPATH}\" \"-d\" \"${LOC}\" ERROR_QUIET)")
else()
install(CODE "execute_process(COMMAND \"${CHRPATH}\" \"-r\" \"${RPATH}\" \"${LOC}\" ERROR_QUIET)")
endif()
endif()
endif()
string(TOUPPER ${DEST} DEST_UPPER)
install(CODE "FILE(INSTALL DESTINATION \"${CMAKE_INSTALL_FULL_${DEST_UPPER}DIR}\" TYPE ${TY} FILES \"${LOC}\")")
endfunction(HHVM_INSTALL)
function(HHVM_PUBLIC_HEADERS TARGET)
install(
CODE "INCLUDE(\"${HPHP_HOME}/CMake/HPHPFunctions.cmake\")
HHVM_INSTALL_HEADERS(${TARGET} ${HPHP_HOME}
\"${CMAKE_INSTALL_FULL_INCLUDEDIR}\" ${ARGN})"
COMPONENT dev)
endfunction()
function(HHVM_INSTALL_HEADERS TARGET SRCROOT DEST)
message(STATUS "Installing header files for ${TARGET}")
foreach(src_rel ${ARGN})
# Determine the relative directory name so that we can mirror the
# directory structure in the output
file(RELATIVE_PATH dest_rel ${SRCROOT} ${src_rel})
if (IS_ABSOLUTE ${dest_rel})
message(WARNING "${TARGET}: Header file ${dest_rel} is not inside ${SRCROOT}")
else()
string(FIND ${dest_rel} / slash_pos REVERSE)
if(slash_pos EQUAL -1)
set(dest_rel)
else()
string(SUBSTRING ${dest_rel} 0 ${slash_pos} dest_rel)
endif()
file(COPY ${src_rel}
DESTINATION "$ENV{DESTDIR}${DEST}/${dest_rel}"
NO_SOURCE_PERMISSIONS)
endif()
endforeach()
endfunction()
macro(HHVM_EXT_OPTION EXTNAME PACKAGENAME)
if (NOT DEFINED EXT_${EXTNAME})
# Implicit check
find_package(${PACKAGENAME})
elseif (EXT_${EXTNAME} STREQUAL "ON")
# Explicit check
find_package(${PACKAGENAME} REQUIRED)
endif()
endmacro()
# Remove all files matching a set of patterns, and,
# optionally, not matching a second set of patterns,
# from a set of lists.
#
# Example:
# This will remove all files in the CPP_SOURCES list
# matching "/test/" or "Test.cpp$", but not matching
# "BobTest.cpp$".
# HHVM_REMOVE_MATCHES_FROM_LISTS(CPP_SOURCES MATCHES "/test/" "Test.cpp$" IGNORE_MATCHES "BobTest.cpp$")
#
# Parameters:
#
# [...]:
# The names of the lists to remove matches from.
#
# [MATCHES ...]:
# The matches to remove from the lists.
#
# [IGNORE_MATCHES ...]:
# The matches not to remove, even if they match
# the main set of matches to remove.
function(HHVM_REMOVE_MATCHES_FROM_LISTS)
set(LISTS_TO_SEARCH)
set(MATCHES_TO_REMOVE)
set(MATCHES_TO_IGNORE)
set(argumentState 0)
foreach (arg ${ARGN})
if ("x${arg}" STREQUAL "xMATCHES")
set(argumentState 1)
elseif ("x${arg}" STREQUAL "xIGNORE_MATCHES")
set(argumentState 2)
elseif (argumentState EQUAL 0)
list(APPEND LISTS_TO_SEARCH ${arg})
elseif (argumentState EQUAL 1)
list(APPEND MATCHES_TO_REMOVE ${arg})
elseif (argumentState EQUAL 2)
list(APPEND MATCHES_TO_IGNORE ${arg})
else()
message(FATAL_ERROR "Unknown argument state!")
endif()
endforeach()
foreach (theList ${LISTS_TO_SEARCH})
foreach (entry ${${theList}})
foreach (match ${MATCHES_TO_REMOVE})
if (${entry} MATCHES ${match})
set(SHOULD_IGNORE OFF)
foreach (ign ${MATCHES_TO_IGNORE})
if (${entry} MATCHES ${ign})
set(SHOULD_IGNORE ON)
break()
endif()
endforeach()
if (NOT SHOULD_IGNORE)
list(REMOVE_ITEM ${theList} ${entry})
endif()
endif()
endforeach()
endforeach()
set(${theList} ${${theList}} PARENT_SCOPE)
endforeach()
endfunction()
# Automatically create source_group directives for the sources passed in.
function(auto_source_group rootName rootDir)
file(TO_CMAKE_PATH "${rootDir}" rootDir)
string(LENGTH "${rootDir}" rootDirLength)
set(sourceGroups)
foreach (fil ${ARGN})
file(TO_CMAKE_PATH "${fil}" filePath)
string(FIND "${filePath}" "/" rIdx REVERSE)
if (rIdx EQUAL -1)
message(FATAL_ERROR "Unable to locate the final forward slash in '${filePath}'!")
endif()
string(SUBSTRING "${filePath}" 0 ${rIdx} filePath)
string(LENGTH "${filePath}" filePathLength)
string(FIND "${filePath}" "${rootDir}" rIdx)
if (rIdx EQUAL 0)
math(EXPR filePathLength "${filePathLength} - ${rootDirLength}")
string(SUBSTRING "${filePath}" ${rootDirLength} ${filePathLength} fileGroup)
string(REPLACE "/" "\\" fileGroup "${fileGroup}")
set(fileGroup "\\${rootName}${fileGroup}")
list(FIND sourceGroups "${fileGroup}" rIdx)
if (rIdx EQUAL -1)
list(APPEND sourceGroups "${fileGroup}")
source_group("${fileGroup}" REGULAR_EXPRESSION "${filePath}/[^/.]+(.(tab|yy))?.(c|cc|cpp|h|hpp|ll|php|tcc|y)$")
endif()
endif()
endforeach()
endfunction()
function(parse_version PREFIX VERSION)
if (NOT ${VERSION} MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+)?(-.+)?$")
message(FATAL_ERROR "VERSION must conform to X.Y(.Z)?(-.+)?")
endif()
string(FIND ${VERSION} "-" SUFFIX_POS)
set(SUFFIX "")
if (SUFFIX_POS)
string(SUBSTRING ${VERSION} ${SUFFIX_POS} -1 SUFFIX)
string(SUBSTRING ${VERSION} 0 ${SUFFIX_POS} NUMERIC_VERSION)
else()
set(NUMERIC_VERSION ${VERSION})
endif()
string(REPLACE "." ";" VERSION_LIST "${NUMERIC_VERSION}")
list(GET VERSION_LIST 0 MAJOR)
list(GET VERSION_LIST 1 MINOR)
list(LENGTH VERSION_LIST VERSION_LIST_LENGTH)
if (VERSION_LIST_LENGTH GREATER 2)
list(GET VERSION_LIST 2 PATCH)
else()
set(PATCH 0)
endif()
set(${PREFIX}MAJOR ${MAJOR} PARENT_SCOPE)
set(${PREFIX}MINOR ${MINOR} PARENT_SCOPE)
set(${PREFIX}PATCH ${PATCH} PARENT_SCOPE)
set(${PREFIX}SUFFIX ${SUFFIX} PARENT_SCOPE)
endfunction()
function(add_object_library libraryName)
add_library(${libraryName} STATIC ${ARGN})
endfunction()
# Get what might be the objects of the object libraries, if needed.
function(get_object_libraries_objects targetVariable)
set(OBJECTS)
set(${targetVariable} ${OBJECTS} PARENT_SCOPE)
endfunction()
# Add the additional link targets for a set of object libraries,
# if needed.
function(link_object_libraries target)
set(WHOLE_ARCHIVE_LIBS)
foreach (fil ${ARGN})
list(APPEND WHOLE_ARCHIVE_LIBS ${fil})
endforeach()
set(ANCHOR_SYMS)
if (APPLE)
set(ANCHOR_SYMS
-Wl,-pagezero_size,0x00001000
# Set the .text.keep section to be executable.
-Wl,-segprot,.text,rx,rx)
foreach(lib ${WHOLE_ARCHIVE_LIBS})
# It's important to use -Xlinker and not -Wl here: ${lib} needs to be its
# own option on the command line, since target_link_libraries will expand it
# from its logical name here into the full .a path. (Eww.)
list(APPEND ANCHOR_SYMS -Xlinker -force_load -Xlinker ${lib})
endforeach()
else()
set(ANCHOR_SYMS -Wl,--whole-archive ${WHOLE_ARCHIVE_LIBS} -Wl,--no-whole-archive)
endif()
target_link_libraries(${target} ${ANCHOR_SYMS})
endfunction()
# This should be called for object libraries, rather than calling
# hphp_link directly.
function(object_library_hphp_link target)
hphp_link(${target})
endfunction()
# If a library needs to be linked in to make GNU ld happy,
# it should be done by calling this.
function(object_library_ld_link_libraries target)
if (${ARGC})
target_link_libraries(${target} ${ARGN})
endif()
endfunction()
set(
HHVM_THIRD_PARTY_SOURCE_CACHE_PREFIX
""
CACHE
STRING
"URL prefix containing cache of third-party dependencies"
)
set(
HHVM_THIRD_PARTY_SOURCE_CACHE_SUFFIX
""
CACHE
STRING
"URL suffix for third-party dependency cache"
)
set(
HHVM_THIRD_PARTY_SOURCE_ONLY_USE_CACHE
OFF
CACHE
BOOL
"Do not download sources that are not in cache; may cause build to fail."
)
set(
HHVM_THIRD_PARTY_SOURCE_URL_LIST_OUTPUT
""
CACHE
STRING
"Path to a text file to put a list of sources that should be in the cache"
)
# Usage:
# SET_HHVM_THIRD_PARTY_SOURCE_ARGS(
# MY_VAR_NAME
# SOURCE_URL https://example.com/
# SOURCE_HASH SHA256=deadbeef
# )
# ... or ...
# SET_HHVM_THIRD_PARTY_SOURCE_ARGS(
# MY_VAR_NAME
# Linux_URL https://example.com/linux.tar.bz2
# Linux_HASH SHA256=deadbeef
# Darwin_URL https://example.com/macos.tar.bz2
# Darwin_HASH SHA256=deadbeef
# )
#
macro(SET_HHVM_THIRD_PARTY_SOURCE_ARGS VAR_NAME)
cmake_parse_arguments(
# Prefix (FOO becomes _arg_FOO - trailing _ implied)
_arg
# No-arg parameter (none):
""
# Single-argument parameters
"SOURCE_URL;SOURCE_HASH;Linux_URL;Linux_HASH;Darwin_URL;Darwin_HASH;FILENAME_PREFIX"
# Multi-argument parameters (none)
""
${ARGN}
)
# Try source, but fall back to platform-specific
if (NOT "${_arg_SOURCE_URL}" STREQUAL "")
set(_URL "${_arg_SOURCE_URL}")
set("${VAR_NAME}" URL_HASH "${_arg_SOURCE_HASH}")
if (NOT "${HHVM_THIRD_PARTY_SOURCE_URL_LIST_OUTPUT}" STREQUAL "")
FILE(
APPEND
"${HHVM_THIRD_PARTY_SOURCE_URL_LIST_OUTPUT}"
"${_arg_SOURCE_URL}\n"
)
endif()
else()
set(_URL "${_arg_${CMAKE_HOST_SYSTEM_NAME}_URL}")
set("${VAR_NAME}" URL_HASH "${_arg_${CMAKE_HOST_SYSTEM_NAME}_HASH}")
if (NOT "${HHVM_THIRD_PARTY_SOURCE_URL_LIST_OUTPUT}" STREQUAL "")
FILE(
APPEND
"${HHVM_THIRD_PARTY_SOURCE_URL_LIST_OUTPUT}"
"${_arg_Linux_URL}\n"
"${_arg_Darwin_URL}\n"
)
endif()
endif()
get_filename_component("_URL_NAME" "${_URL}" NAME)
if ("${HHVM_THIRD_PARTY_SOURCE_CACHE_PREFIX}" STREQUAL "")
list(APPEND ${VAR_NAME} URL "${_URL}")
if (${HHVM_THIRD_PARTY_SOURCE_ONLY_USE_CACHE})
message(
FATAL_ERROR
"HHVM_THIRD_PARTY_ONLY_USE_CACHE is set, but cache is not configured"
)
endif()
else()
list(
APPEND "${VAR_NAME}"
URL
"${HHVM_THIRD_PARTY_SOURCE_CACHE_PREFIX}${_arg_FILENAME_PREFIX}${_URL_NAME}${HHVM_THIRD_PARTY_SOURCE_CACHE_SUFFIX}"
)
if (NOT ${HHVM_THIRD_PARTY_SOURCE_ONLY_USE_CACHE})
list(APPEND "${VAR_NAME}" "${_URL}")
endif()
endif()
list(APPEND "${VAR_NAME}" DOWNLOAD_NAME "${_arg_FILENAME_PREFIX}${_URL_NAME}")
message(STATUS "Download name: ${_arg_FILENAME_PREFIX}${_URL_NAME}")
endmacro()