From: Alexey Samsonov Date: Wed, 19 Dec 2012 12:30:33 +0000 (+0000) Subject: CMake: factor out a function that returns the expected directory for unit test X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e6ddb985657f239a7775380f1cf3e2dbdb1ab308;p=platform%2Fupstream%2Fllvm.git CMake: factor out a function that returns the expected directory for unit test llvm-svn: 170539 --- diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake index 43ee9a0..cfb876e 100755 --- a/llvm/cmake/modules/AddLLVM.cmake +++ b/llvm/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()