diff options
author | Alexey Samsonov <samsonov@google.com> | 2012-12-19 12:30:33 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2012-12-19 12:30:33 +0000 |
commit | 828df0fda8a27c9489be28ee7249d0c149f2eb13 (patch) | |
tree | cc3562a446d6334cf41af4a9ecee565da77ba1ca /cmake | |
parent | 8963fecc86def73634dabf7545322287aa6ae9f8 (diff) |
CMake: factor out a function that returns the expected directory for unit test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170539 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rwxr-xr-x | cmake/modules/AddLLVM.cmake | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake index 43ee9a08b2..cfb876e076 100755 --- a/cmake/modules/AddLLVM.cmake +++ b/cmake/modules/AddLLVM.cmake @@ -155,14 +155,20 @@ macro(add_llvm_external_project name) 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() |