[llvm-commits] [llvm] r170539 - /llvm/trunk/cmake/modules/AddLLVM.cmake
Alexey Samsonov
samsonov at google.com
Wed Dec 19 04:30:33 PST 2012
Author: samsonov
Date: Wed Dec 19 06:30:33 2012
New Revision: 170539
URL: http://llvm.org/viewvc/llvm-project?rev=170539&view=rev
Log:
CMake: factor out a function that returns the expected directory for unit test
Modified:
llvm/trunk/cmake/modules/AddLLVM.cmake
Modified: llvm/trunk/cmake/modules/AddLLVM.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddLLVM.cmake?rev=170539&r1=170538&r2=170539&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/AddLLVM.cmake (original)
+++ llvm/trunk/cmake/modules/AddLLVM.cmake Wed Dec 19 06:30:33 2012
@@ -155,14 +155,20 @@
endif()
endmacro(add_llvm_external_project)
-# Generic support for adding a unittest.
-function(add_unittest test_suite test_name)
+# Returns directory where unittest should reside.
+function(get_unittest_directory dir)
if (CMAKE_BUILD_TYPE)
- set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
- ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE})
+ set(result ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE})
else()
- set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+ set(result ${CMAKE_CURRENT_BINARY_DIR})
endif()
+ set(${dir} ${result} PARENT_SCOPE)
+endfunction()
+
+# Generic support for adding a unittest.
+function(add_unittest test_suite test_name)
+ get_unittest_directory(OUTPUT_DIR)
+ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIR})
if( NOT LLVM_BUILD_TESTS )
set(EXCLUDE_FROM_ALL ON)
endif()
More information about the llvm-commits
mailing list