From 917e24ce402869402e26c1ea56cfeeed95e02d08 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Mon, 4 Nov 2024 15:57:39 -0800 Subject: [PATCH] Add VARS_TO_IGNORE --- cmake/AwsGetCmdArguments.cmake | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cmake/AwsGetCmdArguments.cmake b/cmake/AwsGetCmdArguments.cmake index 77dbb014e..f4dfd0fc3 100644 --- a/cmake/AwsGetCmdArguments.cmake +++ b/cmake/AwsGetCmdArguments.cmake @@ -6,12 +6,22 @@ # strings for variables provided via command line to the "No help, variable specified on the command line." phrase since # at least v3.0. # Via https://cmake.org/pipermail/cmake/2018-January/067002.html +# Arguments: +# VARS_TO_IGNORE Variables that should be ignored even if they were provided via command line. Multiple variables can +# be specified separated by space. # # MUST be done before call to 'project'. The reason is that project() resets help strings for some variables # (e.g. CMAKE_INSTALL_PREFIX). # # Populate AWS_CMAKE_CMD_ARGS with command line variables and their values. function(aws_get_cmd_arguments) + set(multiValueArgs VARS_TO_IGNORE) + cmake_parse_arguments(AWS_GET_CMD_ARGS "" "" "${multiValueArgs}" ${ARGN}) + + if (AWS_GET_CMD_ARGS_VARS_TO_IGNORE) + message(STATUS "Ignored vars: ${AWS_GET_CMD_ARGS_VARS_TO_IGNORE}") + endif() + if (PROJECT_NAME) message(WARNING "aws_get_cmd_arguments is called after project(), some variables may be missed") endif() @@ -25,6 +35,9 @@ function(aws_get_cmd_arguments) foreach(var ${vars}) get_property(currentHelpString CACHE "${var}" PROPERTY HELPSTRING) if ("${currentHelpString}" MATCHES "No help, variable specified on the command line.") + if("${var}" IN_LIST AWS_GET_CMD_ARGS_VARS_TO_IGNORE) + continue() + endif() set(escaped_var ${${var}}) # To store a list within another list, it needs to be escaped first. string(REPLACE ";" "\\\\;" escaped_var "${${var}}")