diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2019-02-13 19:16:46 (GMT) |
---|---|---|
committer | Sebastian Holtermann <sebholt@xwmw.org> | 2019-02-13 21:54:32 (GMT) |
commit | 724359489e03c1c890bea4bc6ba71ca353b048b9 (patch) | |
tree | 4db865452aafb009dbdbe651f4bf9a82ddfd9107 /Tests | |
parent | 6ed4ae4bad3bf3e226e0c8009f9b4057707cfc21 (diff) | |
download | CMake-724359489e03c1c890bea4bc6ba71ca353b048b9.zip CMake-724359489e03c1c890bea4bc6ba71ca353b048b9.tar.gz CMake-724359489e03c1c890bea4bc6ba71ca353b048b9.tar.bz2 |
Autogen: Refactor RerunRccConfigChange test
This refactors and simplifies the QtAutogen.RerunRccConfigChange test.
Repetitive task are packed into macros.
Test status and error messages are improved.
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt b/Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt index dcb7a79..33c01ac 100644 --- a/Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt +++ b/Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt @@ -9,10 +9,23 @@ add_executable(dummy dummy.cpp) # When a .qrc or a file listed in a .qrc file changes, # the target must be rebuilt -set(timeformat "%Y%j%H%M%S") set(rccDepSD "${CMAKE_CURRENT_SOURCE_DIR}/RccConfigChange") set(rccDepBD "${CMAKE_CURRENT_BINARY_DIR}/RccConfigChange") +# 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() + # Initial build try_compile(RCC_DEPENDS "${rccDepBD}" @@ -24,19 +37,11 @@ try_compile(RCC_DEPENDS OUTPUT_VARIABLE output ) if (NOT RCC_DEPENDS) - message(SEND_ERROR "Initial build of rccConfigChange failed. Output: ${output}") + message(FATAL_ERROR "Initial build of rccConfigChange failed. Output: ${output}") endif() -# - Rebuild Release -message("Rebuilding rccConfigChange in Release configuration") -execute_process(COMMAND "${CMAKE_COMMAND}" --build . --config Release WORKING_DIRECTORY "${rccDepBD}" RESULT_VARIABLE result) -if (result) - message(SEND_ERROR "Release build of rccConfigChange failed.") -endif() +# Rebuild: Release +rebuild(Release) -# - Rebuild Debug -message("Rebuilding rccConfigChange in Debug configuration") -execute_process(COMMAND "${CMAKE_COMMAND}" --build . --config Debug WORKING_DIRECTORY "${rccDepBD}" RESULT_VARIABLE result) -if (result) - message(SEND_ERROR "Debug build of rccConfigChange failed.") -endif() +# Rebuild: Debug +rebuild(Debug) |