aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/cmake/RunCMake/generate_context_property_dump/RunCMakeTest.cmake
blob: 1758173b63a85eb634afb0d02f99a32c532e39de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Copyright (C) 2025 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause

include(QtRunCMake)

# Stub function to make `_qt_internal_get_cmake_test_configure_options` work
function(_qt_internal_get_build_vars_for_external_projects)
endfunction()

set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/GenerateContextProperty")
set(RunCMake_TEST_NO_CLEAN 1)
set(RunCMake_TEST_OUTPUT_MERGE 1)
run_cmake_with_options(
    configuration
    "-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}"
)
run_cmake_command(build
    ${CMAKE_COMMAND} --build ${RunCMake_TEST_BINARY_DIR} --target dump_qml_context_properties)

if(NOT EXISTS ${RunCMake_TEST_BINARY_DIR}/.qt/contextPropertyDump.ini)
    message(FATAL_ERROR "${RunCMake_TEST_BINARY_DIR}/.contextPropertyDump.ini was not created.")
endif()

run_cmake_command(build
    ${CMAKE_COMMAND} --build ${RunCMake_TEST_BINARY_DIR} --target clean_qml_context_properties)

if(EXISTS ${RunCMake_TEST_BINARY_DIR}/.qt/contextPropertyDump.ini)
    message(FATAL_ERROR "${RunCMake_TEST_BINARY_DIR}/.contextPropertyDump.ini was not cleaned.")
endif()