mirror of
https://github.com/blender/blender
synced 2026-10-25 03:07:01 +03:00
Functions scope their variables, macros don't. Use functions for better variable hygiene, with `PARENT_SCOPE` where output variables need to propagate. This avoids the need to `unset(...)` every local variable which is easy to forget - leaking variables into the callers scope. Macros that must remain (flag modification, `find_package` forwarding, paired state, caller-scope `return()`) are annotated with the reason in their doc-strings.
20 lines
635 B
CMake
20 lines
635 B
CMake
# SPDX-FileCopyrightText: 2022 Blender Authors
|
|
#
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
# shorthand to only unpack a certain dependency
|
|
function(unpack_only name)
|
|
string(TOUPPER ${name} UPPER_NAME)
|
|
set(TARGET_FILE ${${UPPER_NAME}_FILE})
|
|
set(TARGET_HASH_TYPE ${${UPPER_NAME}_HASH_TYPE})
|
|
set(TARGET_HASH ${${UPPER_NAME}_HASH})
|
|
ExternalProject_Add(external_${name}
|
|
URL file://${PACKAGE_DIR}/${TARGET_FILE}
|
|
URL_HASH ${TARGET_HASH_TYPE}=${TARGET_HASH}
|
|
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
|
PREFIX ${BUILD_DIR}/${name}
|
|
CONFIGURE_COMMAND echo .
|
|
BUILD_COMMAND echo .
|
|
INSTALL_COMMAND echo .
|
|
)
|
|
endfunction()
|