32df595275
Task-number: QTBUG-105718 Change-Id: I5d3ef70a31235868b9be6cb479b7621bf2a8ba39 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
36 lines
1.1 KiB
CMake
36 lines
1.1 KiB
CMake
# Copyright (C) 2022 The Qt Company Ltd.
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
# 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:
|
|
# IN_FILE: The input file. The whole command line as one string.
|
|
# OUT_FILE: The output file. One argument per line.
|
|
# SKIP_ARGS: Number of arguments to skip from the front of the arguments list.
|
|
# IGNORE_ARGS: List of arguments to be ignored, i.e. that are not written.
|
|
|
|
cmake_minimum_required(VERSION 3.16)
|
|
|
|
# Read arguments from IN_FILE and separate them.
|
|
file(READ "${IN_FILE}" raw_args)
|
|
separate_arguments(args NATIVE_COMMAND "${raw_args}")
|
|
|
|
# Skip arguments if requested
|
|
if(DEFINED SKIP_ARGS)
|
|
foreach(i RANGE 1 ${SKIP_ARGS})
|
|
list(POP_FRONT args)
|
|
endforeach()
|
|
endif()
|
|
|
|
# Write config.opt
|
|
set(content "")
|
|
foreach(arg IN LISTS args)
|
|
if(NOT arg IN_LIST IGNORE_ARGS)
|
|
string(APPEND content "${arg}\n")
|
|
endif()
|
|
endforeach()
|
|
|
|
file(WRITE "${OUT_FILE}" "${content}")
|