Add check for CTest module include

add_test function should only be used if the CTest module is included
in the root CMakeLists.txt. unit_test_add_suite() function now verifies
this condition.

Change-Id: I39821798e24844caeab6196eb31875e5d3d60f1d
Signed-off-by: Imre Kis <imre.kis@arm.com>
diff --git a/cmake/UnitTest.cmake b/cmake/UnitTest.cmake
index cb496f7..fcd0f09 100644
--- a/cmake/UnitTest.cmake
+++ b/cmake/UnitTest.cmake
@@ -22,6 +22,12 @@
 	cmake_parse_arguments(_MY_PARAMS "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN})
 	# TODO: check_args(add_unit_test_suite args1 args2 args3)
 
+	if(NOT DEFINED BUILD_TESTING)
+		message(FATAL_ERROR
+			"add_unit_test_suite(): "
+			"CTest module should be included in the root CMakeLists.txt before calling this function.")
+	endif()
+
 	set(TEST_NAME ${_MY_PARAMS_NAME})
 	set(TEST_INCLUDE_DIRECTORIES ${_MY_PARAMS_INCLUDE_DIRECTORIES})
 	set(TEST_COMPILE_DEFINITIONS ${_MY_PARAMS_COMPILE_DEFINITIONS})