diff options
author | George Karpenkov <ekarpenkov@apple.com> | 2017-08-15 18:35:02 +0000 |
---|---|---|
committer | George Karpenkov <ekarpenkov@apple.com> | 2017-08-15 18:35:02 +0000 |
commit | 0ea082ef441a219374b785aa0a1a3e290015d852 (patch) | |
tree | a088cbb5914415d2c9b939b2f0f3255f6159cc5b /cmake | |
parent | 8ffc41adbd409d8e5c2211cf93b8db79158d7a9d (diff) |
[compiler-rt CMake] NFC: Minor CMake refactoring.
Change macro to a function, and use a generic variable instead of
branching for handling multi-output build with
CMAKE_CONFIGURATION_TYPES.
Differential Revision: https://reviews.llvm.org/D36725
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@310944 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/Modules/CompilerRTCompile.cmake | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/cmake/Modules/CompilerRTCompile.cmake b/cmake/Modules/CompilerRTCompile.cmake index b39ca4ef8..8727f5bb3 100644 --- a/cmake/Modules/CompilerRTCompile.cmake +++ b/cmake/Modules/CompilerRTCompile.cmake @@ -27,7 +27,7 @@ endfunction() # Compile a sanitizer test with a freshly built clang # for a given architecture, adding the result to the object list. # - obj_list: output list of objects, populated by path -# of the generated object file. +# of a generated object file. # - source: source file of a test. # - arch: architecture to compile for. # sanitizer_test_compile(<obj_list> <source> <arch> @@ -36,16 +36,12 @@ endfunction() # DEPS <list of dependencies> # CFLAGS <list of flags> # ) -macro(sanitizer_test_compile obj_list source arch) +function(sanitizer_test_compile obj_list source arch) cmake_parse_arguments(TEST "" "" "KIND;COMPILE_DEPS;DEPS;CFLAGS" ${ARGN}) get_filename_component(basename ${source} NAME) - if(CMAKE_CONFIGURATION_TYPES) - set(output_obj - "${CMAKE_CFG_INTDIR}/${obj_list}.${basename}.${arch}${TEST_KIND}.o") - else() - set(output_obj "${obj_list}.${basename}.${arch}${TEST_KIND}.o") - endif() + set(output_obj + "${CMAKE_CFG_RESOLVED_INTDIR}${obj_list}.${basename}.${arch}${TEST_KIND}.o") # Write out architecture-specific flags into TARGET_CFLAGS variable. get_target_flags_for_arch(${arch} TARGET_CFLAGS) @@ -57,7 +53,8 @@ macro(sanitizer_test_compile obj_list source arch) CFLAGS ${TEST_CFLAGS} ${TARGET_CFLAGS} DEPS ${TEST_COMPILE_DEPS}) list(APPEND ${obj_list} ${output_obj}) -endmacro() + set("${obj_list}" "${${obj_list}}" PARENT_SCOPE) +endfunction() # Compile a source into an object file with COMPILER_RT_TEST_COMPILER using # a provided compile flags and dependenices. |