summaryrefslogtreecommitdiff
path: root/tests/compilation/RunCompilationTests.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'tests/compilation/RunCompilationTests.cmake')
-rw-r--r--tests/compilation/RunCompilationTests.cmake26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/compilation/RunCompilationTests.cmake b/tests/compilation/RunCompilationTests.cmake
new file mode 100644
index 0000000..91a542b
--- /dev/null
+++ b/tests/compilation/RunCompilationTests.cmake
@@ -0,0 +1,26 @@
+# This script executes the compilation tests defined in CompilationTests.cmake
+
+# Clean up and re-create a build directory for the tests project
+execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory ${BINARY_DIR})
+execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${BINARY_DIR})
+
+# Copy the necessary files
+execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${SOURCE_DIR}/CompilationTests_CMakeLists.txt
+ ${BINARY_DIR}/CMakeLists.txt)
+execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${SOURCE_DIR}/CompilationTests.cmake
+ ${BINARY_DIR}/CompilationTests.cmake)
+
+# Run cmake to execute the tests
+execute_process(COMMAND ${CMAKE_COMMAND}
+ -DQTGSTREAMER_LIBRARY=${QTGSTREAMER_LIBRARY}
+ -DQTGSTREAMER_UI_LIBRARY=${QTGSTREAMER_UI_LIBRARY}
+ -DQTGSTREAMER_INCLUDE_DIR=${QTGSTREAMER_INCLUDE_DIR}
+ -DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}
+ WORKING_DIRECTORY ${BINARY_DIR}
+ OUTPUT_QUIET
+ RESULT_VARIABLE TESTS_RESULT
+)
+
+if (NOT (${TESTS_RESULT} EQUAL 0))
+ message(FATAL_ERROR "Compilation tests failed!")
+endif()