qt5base-lts/cmake/QtLoadFilePrintVars.cmake
Joerg Bornemann 7c62caa355 Make toolchain inspection more robust
QtAutoDetect.cmake did read the (possibly detected) toolchain file and
looked for the string "The Android Open Source Project" to deduce that
we want to build for Android. This has been done, because we're
autodetecting the platform before the first project comment, i.e. before
the toolchain file is loaded.

This magic string detection is a bit fragile, and we need a similar
approach for WebAssembly. A more robust approach would be to fetch the
value of CMAKE_SYSTEM_NAME from the toolchain file without actually
loading it.

Now, we run a CMake script that includes the toolchain file and prints
variables were interested in. The calling code reads these variables and
stores them in prefixed variables in the current scope.

Change-Id: Ide9ea3054e1453d17129523e1ec86ecaed55af2a
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-03-04 09:55:41 +01:00

16 lines
399 B
CMake

# Load a file and print variables and their values
#
# IN_FILE: path to a file to be included
# VARIABLES: list of variables to be printed
cmake_minimum_required(VERSION 3.16)
include("${IN_FILE}")
# Print a magic comment that the caller must look for
message(STATUS "---QtLoadFilePrintVars---")
# Print the variables
foreach(v IN LISTS VARIABLES)
message(STATUS "${v} ${${v}}")
endforeach()