qt5base-lts/coin/instructions/qmake/ensure_pro_file.cmake
Alexandru Croitor 24f12d0cef CMake: Build examples with qmake against a CMake built Qt
We want to remove the Qt .pro files for projects, except examples,
because examples are still meant to build with qmake.

To not lose coverage on examples built with qmake, add instructions that
will build the qtrepo/examples folder with qmake when the CMake
configuration has -DQT_BUILD_EXAMPLES=ON.

This means that such configurations will build examples both with CMake
and qmake.

Aside from making sure that our examples will still build with qmake, it
will gives us some some coverage that a CMake-built qmake works
correctly.

Implementation-wise, add new instructions files that can call qmake and
make depending on configuration and target type.

Pick-to: 6.0
Fixes: QTBUG-85986
Change-Id: Ie8f4cbcda03c94da2aef455e32f48dad41a4bdb0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-12-04 15:39:32 +01:00

17 lines
448 B
CMake

# CMake script to ensure that a qmake project file exists.
#
# Usage: cmake -DPRO_FILE=.../project.pro -P .../ensure_pro_file.cmake
#
# This script checks for existence of ${PRO_FILE} and creates a fake one, if needed.
#
if(NOT EXISTS "${PRO_FILE}")
get_filename_component(dir "${PRO_FILE}" DIRECTORY)
if(NOT IS_DIRECTORY "${dir}")
file(MAKE_DIRECTORY "${dir}")
endif()
file(WRITE "${PRO_FILE}" "TEMPLATE = aux
")
endif()