summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuha Vuolle <juha.vuolle@insta.fi>2021-05-25 20:15:18 +0300
committerJuha Vuolle <juha.vuolle@insta.fi>2021-05-26 13:35:39 +0300
commit07397b6f3c8d81ac05c9db606a05fde35de873ab (patch)
tree9ee4d32fa0c524afe0deb03fc900bdc2505ff3b9
parent87405869e6b54ea874930dee27d351c57e38c083 (diff)
Fix autotest compilation error on Windows/MinGW
For some reason with MinGW the statemachine code generation failed silently if the provided output directory (where to store the generated .h and .cpp files) did not exist. This commit creates the directory and also adds a warning if nonexistent directory is tried to use. Pick-to: 6.1 Change-Id: I161d7646b4be5bf52fd045d0bf124ab2f8987668 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
-rw-r--r--src/scxml/Qt6ScxmlMacros.cmake5
-rw-r--r--tests/auto/scxmlcoutput/path/CMakeLists.txt9
2 files changed, 12 insertions, 2 deletions
diff --git a/src/scxml/Qt6ScxmlMacros.cmake b/src/scxml/Qt6ScxmlMacros.cmake
index 4ced82e..a1559c5 100644
--- a/src/scxml/Qt6ScxmlMacros.cmake
+++ b/src/scxml/Qt6ScxmlMacros.cmake
@@ -53,6 +53,11 @@ function(qt6_add_statecharts target_or_outfiles)
set(qscxmlcOutputDir ${CMAKE_CURRENT_BINARY_DIR})
if (ARGS_OUTPUT_DIR)
set(qscxmlcOutputDir ${ARGS_OUTPUT_DIR})
+ if (NOT EXISTS "${qscxmlcOutputDir}" OR NOT IS_DIRECTORY "${qscxmlcOutputDir}")
+ message(WARNING
+ "qt6_add_statecharts: output dir does not exist: \"" ${qscxmlcOutputDir} "\". "
+ "Statechart code generation may fail on some platforms." )
+ endif()
endif()
foreach(it ${scxml_files})
diff --git a/tests/auto/scxmlcoutput/path/CMakeLists.txt b/tests/auto/scxmlcoutput/path/CMakeLists.txt
index ba49f43..cb7f548 100644
--- a/tests/auto/scxmlcoutput/path/CMakeLists.txt
+++ b/tests/auto/scxmlcoutput/path/CMakeLists.txt
@@ -5,8 +5,13 @@ qt_internal_add_test(tst_scxmlcoutput_path
Qt::Scxml
)
-# This testcase tests providing the namespace
+# This testcase tests setting the output path
+set(outputPath "${CMAKE_CURRENT_BINARY_DIR}/thechosenpath")
+# Create the path first relative to the build directory, otherwise the
+# code generation's output might fail on some platforms.
+file(MAKE_DIRECTORY "${outputPath}")
+
qt6_add_statecharts(tst_scxmlcoutput_path
../shared/ids1.scxml
- OUTPUT_DIR thechosenpath
+ OUTPUT_DIR "${outputPath}"
)