[Orxonox-commit 5525] r10188 - in code/trunk/test: . core util
landauf at orxonox.net
landauf at orxonox.net
Sat Jan 10 16:39:16 CET 2015
Author: landauf
Date: 2015-01-10 16:39:15 +0100 (Sat, 10 Jan 2015)
New Revision: 10188
Modified:
code/trunk/test/CMakeLists.txt
code/trunk/test/core/CMakeLists.txt
code/trunk/test/util/CMakeLists.txt
Log:
change cmake policy in order to avoid warning because we currently can't solve this in another way.
added new build target to build tests without executing them.
Modified: code/trunk/test/CMakeLists.txt
===================================================================
--- code/trunk/test/CMakeLists.txt 2015-01-10 13:48:02 UTC (rev 10187)
+++ code/trunk/test/CMakeLists.txt 2015-01-10 15:39:15 UTC (rev 10188)
@@ -33,8 +33,21 @@
ENABLE_TESTING()
+# A target to execute tests. This override the native 'test' target of cmake and allows us to
+# define dependences (i.e. to let cmake build the tests before executing them)
+IF (POLICY CMP0037)
+ CMAKE_POLICY(PUSH)
+ CMAKE_POLICY(SET CMP0037 OLD) # we currently have to override the original 'test' target until cmake provides a better way to define dependencies to the test target
+ENDIF()
ADD_CUSTOM_TARGET(test COMMAND ${CMAKE_CTEST_COMMAND} "$(ARGS)" COMMENT "Running tests")
+IF (POLICY CMP0037)
+ CMAKE_POLICY(POP) # restore policy settings
+ENDIF()
+# A target to build all tests
+ADD_CUSTOM_TARGET(all_tests)
+ADD_DEPENDENCIES(test all_tests) # build tests before executing them
+
CONFIGURE_FILE("CTestCustom.cmake" "CTestCustom.cmake" @ONLY)
############## Include Directories ##############
Modified: code/trunk/test/core/CMakeLists.txt
===================================================================
--- code/trunk/test/core/CMakeLists.txt 2015-01-10 13:48:02 UTC (rev 10187)
+++ code/trunk/test/core/CMakeLists.txt 2015-01-10 15:39:15 UTC (rev 10188)
@@ -27,6 +27,6 @@
object/SmartPtrTest.cc
object/WeakPtrTest.cc
)
-ADD_DEPENDENCIES(test core_test)
+ADD_DEPENDENCIES(all_tests core_test)
ADD_TEST(core_test ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/core_test --gtest_output=xml)
Modified: code/trunk/test/util/CMakeLists.txt
===================================================================
--- code/trunk/test/util/CMakeLists.txt 2015-01-10 13:48:02 UTC (rev 10187)
+++ code/trunk/test/util/CMakeLists.txt 2015-01-10 15:39:15 UTC (rev 10188)
@@ -30,6 +30,6 @@
output/OutputStreamTest.cc
output/SubcontextOutputListenerTest.cc
)
-ADD_DEPENDENCIES(test util_test)
+ADD_DEPENDENCIES(all_tests util_test)
ADD_TEST(util_test ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/util_test --gtest_output=xml)
More information about the Orxonox-commit
mailing list