r174691 - CMake: Optionally allow running the Clang unit tests in standalone builds.

Jordan Rose jordan_rose at apple.com
Thu Feb 7 17:42:37 PST 2013


Author: jrose
Date: Thu Feb  7 19:42:37 2013
New Revision: 174691

URL: http://llvm.org/viewvc/llvm-project?rev=174691&view=rev
Log:
CMake: Optionally allow running the Clang unit tests in standalone builds.

The reason this is not enabled by default is because there is no way for
Clang to guarantee that the LLVM unit testing infrastruture has been built.
However, if it /has/ been built, there's no reason why the standalone Clang
build can't use it!

This should have no effect on existing builds -- in a combined build the
value of the CLANG_INCLUDE_TESTS option defaults to the LLVM equivalent,
and in a standalone build it defaults to off.

Modified:
    cfe/trunk/CMakeLists.txt

Modified: cfe/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=174691&r1=174690&r2=174691&view=diff
==============================================================================
--- cfe/trunk/CMakeLists.txt (original)
+++ cfe/trunk/CMakeLists.txt Thu Feb  7 19:42:37 2013
@@ -279,10 +279,17 @@ add_subdirectory(examples)
 # TODO: docs.
 add_subdirectory(test)
 
-if( LLVM_INCLUDE_TESTS )
-  if( NOT CLANG_BUILT_STANDALONE )
-    add_subdirectory(unittests)
-  endif()
+option(CLANG_BUILD_TESTS
+       "Build Clang unit tests. If OFF, just generate build targets." 
+       LLVM_BUILD_TESTS)
+option(CLANG_INCLUDE_TESTS
+       "Generate build targets for the Clang unit tests."
+       LLVM_INCLUDE_TESTS)
+
+if( CLANG_INCLUDE_TESTS )
+  add_subdirectory(unittests)
+elseif( CLANG_BUILD_TESTS )
+  message(FATAL_ERROR "CLANG_BUILD_TESTS requires CLANG_INCLUDE_TESTS")
 endif()
 
 # Workaround for MSVS10 to avoid the Dialog Hell





More information about the cfe-commits mailing list