48 lines
1.3 KiB
CMake
Raw Normal View History

2018-08-09 18:06:22 +02:00
cmake_minimum_required(VERSION 3.11.2)
project(RerunRccConfigChange)
2019-11-11 23:01:05 +01:00
include("../AutogenCoreTest.cmake")
2018-08-09 18:06:22 +02:00
# Tests rcc rebuilding after a configuration change
# Dummy executable to generate a clean target
add_executable(dummy dummy.cpp)
# When a .qrc or a file listed in a .qrc file changes,
# the target must be rebuilt
set(rccDepSD "${CMAKE_CURRENT_SOURCE_DIR}/RccConfigChange")
set(rccDepBD "${CMAKE_CURRENT_BINARY_DIR}/RccConfigChange")
2019-11-11 23:01:05 +01:00
# Rebuild macro
macro(rebuild CFG)
message(STATUS "Rebuilding rccConfigChange in ${CFG} configuration.")
execute_process(
COMMAND "${CMAKE_COMMAND}" --build . --config "${CFG}"
WORKING_DIRECTORY "${rccDepBD}"
RESULT_VARIABLE result)
if (result)
message(FATAL_ERROR "${CFG} build of rccConfigChange failed.")
else()
message(STATUS "${CFG} build of rccConfigChange finished.")
endif()
endmacro()
2018-08-09 18:06:22 +02:00
# Initial build
try_compile(RCC_DEPENDS
"${rccDepBD}"
"${rccDepSD}"
RccConfigChange
CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
2018-10-28 12:09:07 +01:00
"-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}"
2018-08-09 18:06:22 +02:00
"-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
OUTPUT_VARIABLE output
)
if (NOT RCC_DEPENDS)
2019-11-11 23:01:05 +01:00
message(FATAL_ERROR "Initial build of rccConfigChange failed. Output: ${output}")
2018-08-09 18:06:22 +02:00
endif()
2019-11-11 23:01:05 +01:00
# Rebuild: Release
rebuild(Release)
2018-08-09 18:06:22 +02:00
2019-11-11 23:01:05 +01:00
# Rebuild: Debug
rebuild(Debug)