From 257e8bf8519b7bff4abbf117566ebce9b41c4edc Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Wed, 4 Aug 2021 16:58:45 +0200 Subject: [PATCH] Pass 'make' between vcpkg scripts --- scripts/cmake/vcpkg_build_make.cmake | 19 +++++++------------ scripts/cmake/vcpkg_configure_make.cmake | 7 +++++++ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/scripts/cmake/vcpkg_build_make.cmake b/scripts/cmake/vcpkg_build_make.cmake index 30b073c5032853..10f702693fe56b 100755 --- a/scripts/cmake/vcpkg_build_make.cmake +++ b/scripts/cmake/vcpkg_build_make.cmake @@ -81,15 +81,16 @@ function(vcpkg_build_make) string(REPLACE " " "\ " _VCPKG_INSTALLED "${CURRENT_INSTALLED_DIR}") endif() - set(MAKE ) set(MAKE_OPTS ) set(INSTALL_OPTS ) if (CMAKE_HOST_WIN32) set(PATH_GLOBAL "$ENV{PATH}") vcpkg_add_to_path(PREPEND "${SCRIPTS}/buildsystems/make_wrapper") - vcpkg_acquire_msys(MSYS_ROOT) - find_program(MAKE make PATHS "${MSYS_ROOT}/usr/bin" NO_DEFAULT_PATH REQUIRED) - set(MAKE_COMMAND "${MAKE}") + if(NOT DEFINED Z_VCPKG_MAKE) + vcpkg_acquire_msys(MSYS_ROOT) + find_program(Z_VCPKG_MAKE make PATHS "${MSYS_ROOT}/usr/bin" NO_DEFAULT_PATH REQUIRED) + endif() + set(MAKE_COMMAND "${Z_VCPKG_MAKE}") set(MAKE_OPTS ${_bc_MAKE_OPTIONS} -j ${VCPKG_CONCURRENCY} --trace -f ${_bc_MAKEFILE} ${_bc_BUILD_TARGET}) set(NO_PARALLEL_MAKE_OPTS ${_bc_MAKE_OPTIONS} -j 1 --trace -f ${_bc_MAKEFILE} ${_bc_BUILD_TARGET}) @@ -98,14 +99,8 @@ function(vcpkg_build_make) set(INSTALL_OPTS -j ${VCPKG_CONCURRENCY} --trace -f ${_bc_MAKEFILE} ${_bc_INSTALL_TARGET} DESTDIR=${_VCPKG_PACKAGE_PREFIX}) #TODO: optimize for install-data (release) and install-exec (release/debug) else() - # Compiler requriements - if(VCPKG_HOST_IS_OPENBSD) - find_program(MAKE gmake REQUIRED) - else() - find_program(MAKE make REQUIRED) - endif() - set(MAKE_COMMAND "${MAKE}") - # Set make command and install command + find_program(Z_VCPKG_MAKE gmake make REQUIRED) + set(MAKE_COMMAND "${Z_VCPKG_MAKE}") set(MAKE_OPTS ${_bc_MAKE_OPTIONS} V=1 -j ${VCPKG_CONCURRENCY} -f ${_bc_MAKEFILE} ${_bc_BUILD_TARGET}) set(NO_PARALLEL_MAKE_OPTS ${_bc_MAKE_OPTIONS} V=1 -j 1 -f ${_bc_MAKEFILE} ${_bc_BUILD_TARGET}) set(INSTALL_OPTS -j ${VCPKG_CONCURRENCY} -f ${_bc_MAKEFILE} ${_bc_INSTALL_TARGET} DESTDIR=${CURRENT_PACKAGES_DIR}) diff --git a/scripts/cmake/vcpkg_configure_make.cmake b/scripts/cmake/vcpkg_configure_make.cmake index f9a04266090027..f4a0b207e03aa0 100644 --- a/scripts/cmake/vcpkg_configure_make.cmake +++ b/scripts/cmake/vcpkg_configure_make.cmake @@ -861,6 +861,13 @@ function(vcpkg_configure_make) endforeach() endforeach() + # Export matching make program for vcpkg_build_make (cache variable) + if(MSYS_ROOT) + find_program(Z_VCPKG_MAKE make PATHS "${MSYS_ROOT}/usr/bin" NO_DEFAULT_PATH REQUIRED) + else() + find_program(Z_VCPKG_MAKE gmake make REQUIRED) + endif() + # Restore environment _vcpkg_restore_env_variables(${_cm_FLAGS} LIB LIBPATH LIBRARY_PATH LD_LIBRARY_PATH)