2022-07-05 11:26:52 +00:00
|
|
|
# Copyright (C) 2022 The Qt Company Ltd.
|
|
|
|
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
|
|
|
2020-10-29 10:34:32 +00:00
|
|
|
# This script writes its arguments to the file determined by OUT_FILE.
|
|
|
|
# Each argument appears on a separate line.
|
|
|
|
# This is used for writing the config.opt file.
|
|
|
|
#
|
|
|
|
# This script takes the following arguments:
|
2021-08-20 12:34:37 +00:00
|
|
|
# IN_FILE: The input file. The whole command line as one string.
|
|
|
|
# OUT_FILE: The output file. One argument per line.
|
2020-10-29 10:34:32 +00:00
|
|
|
# SKIP_ARGS: Number of arguments to skip from the front of the arguments list.
|
2020-11-02 19:45:01 +00:00
|
|
|
# IGNORE_ARGS: List of arguments to be ignored, i.e. that are not written.
|
|
|
|
|
2021-09-22 13:11:47 +00:00
|
|
|
cmake_minimum_required(VERSION 3.16)
|
2020-10-29 10:34:32 +00:00
|
|
|
|
2021-08-20 12:34:37 +00:00
|
|
|
# Read arguments from IN_FILE and separate them.
|
|
|
|
file(READ "${IN_FILE}" raw_args)
|
|
|
|
separate_arguments(args NATIVE_COMMAND "${raw_args}")
|
2020-10-29 10:34:32 +00:00
|
|
|
|
|
|
|
# Skip arguments if requested
|
|
|
|
if(DEFINED SKIP_ARGS)
|
2021-08-20 12:34:37 +00:00
|
|
|
foreach(i RANGE 1 ${SKIP_ARGS})
|
|
|
|
list(POP_FRONT args)
|
|
|
|
endforeach()
|
2020-10-29 10:34:32 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# Write config.opt
|
|
|
|
set(content "")
|
2021-08-20 12:34:37 +00:00
|
|
|
foreach(arg IN LISTS args)
|
|
|
|
if(NOT arg IN_LIST IGNORE_ARGS)
|
|
|
|
string(APPEND content "${arg}\n")
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
|
2020-10-29 10:34:32 +00:00
|
|
|
file(WRITE "${OUT_FILE}" "${content}")
|