[llvm-commits] [compiler-rt] r170870 - in /compiler-rt/trunk: cmake/Modules/CompilerRTUnittests.cmake lib/asan/tests/CMakeLists.txt lib/sanitizer_common/tests/CMakeLists.txt

Alexey Samsonov samsonov at google.com
Fri Dec 21 00:56:14 PST 2012


Author: samsonov
Date: Fri Dec 21 02:56:14 2012
New Revision: 170870

URL: http://llvm.org/viewvc/llvm-project?rev=170870&view=rev
Log:
[Sanitizer] Don't implicitly add object files to the list of dependencies when building compiler_rt unittests. Fix sanitizer_common and asan build rules accordingly. This also fixes check-sanitizer command on Ninja.

Modified:
    compiler-rt/trunk/cmake/Modules/CompilerRTUnittests.cmake
    compiler-rt/trunk/lib/asan/tests/CMakeLists.txt
    compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt

Modified: compiler-rt/trunk/cmake/Modules/CompilerRTUnittests.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/CompilerRTUnittests.cmake?rev=170870&r1=170869&r2=170870&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/Modules/CompilerRTUnittests.cmake (original)
+++ compiler-rt/trunk/cmake/Modules/CompilerRTUnittests.cmake Fri Dec 21 02:56:14 2012
@@ -24,7 +24,7 @@
     OUTPUT ${output_bin}
     COMMAND clang ${TEST_OBJECTS} -o "${output_bin}"
             ${TEST_LINK_FLAGS}
-    DEPENDS clang ${TEST_DEPS} ${TEST_OBJECTS})
+    DEPENDS clang ${TEST_DEPS})
   add_custom_target(${test_name} DEPENDS ${output_bin})
   # Make the test suite depend on the binary.
   add_dependencies(${test_suite} ${test_name})

Modified: compiler-rt/trunk/lib/asan/tests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/CMakeLists.txt?rev=170870&r1=170869&r2=170870&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/asan/tests/CMakeLists.txt Fri Dec 21 02:56:14 2012
@@ -99,7 +99,7 @@
   get_target_flags_for_arch(${arch} TARGET_LINK_FLAGS)
   add_compiler_rt_test(${test_suite} ${test_name}
                        OBJECTS ${ARGN}
-                       DEPS ${ASAN_RUNTIME_LIBRARIES}
+                       DEPS ${ASAN_RUNTIME_LIBRARIES} ${ARGN}
                        LINK_FLAGS ${ASAN_LINK_FLAGS}
                                   ${TARGET_LINK_FLAGS})
 endmacro()

Modified: compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt?rev=170870&r1=170869&r2=170870&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt Fri Dec 21 02:56:14 2012
@@ -21,16 +21,16 @@
   add_library(${library} STATIC ${ARGN})
   set_target_properties(${library} PROPERTIES
     ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
-  set(lib_name "lib${library}.a")
-  add_custom_target(${lib_name} DEPENDS ${library})
 endmacro()
 
-function(get_sanitizer_common_lib_for_arch arch lib_name)
+function(get_sanitizer_common_lib_for_arch arch lib lib_name)
   if(APPLE)
-    set(${lib_name} "libRTSanitizerCommon.test.osx.a" PARENT_SCOPE)
+    set(tgt_name "RTSanitizerCommon.test.osx")
   else()
-    set(${lib_name} "libRTSanitizerCommon.test.${arch}.a" PARENT_SCOPE)
+    set(tgt_name "RTSanitizerCommon.test.${arch}")
   endif()
+  set(${lib} "${tgt_name}" PARENT_SCOPE)
+  set(${lib_name} "lib${tgt_name}.a" PARENT_SCOPE)
 endfunction()
 
 # Sanitizer_common unit tests testsuite.
@@ -58,12 +58,14 @@
                   DEPS gtest ${SANITIZER_RUNTIME_LIBRARIES})
     list(APPEND SANITIZER_TEST_OBJECTS ${output_obj})
   endforeach()
-  get_sanitizer_common_lib_for_arch(${arch} SANITIZER_COMMON_LIB_NAME)
+  get_sanitizer_common_lib_for_arch(${arch} SANITIZER_COMMON_LIB
+                                    SANITIZER_COMMON_LIB_NAME)
   # Add unittest target.
   set(SANITIZER_TEST_NAME "Sanitizer-${arch}-Test")
   add_compiler_rt_test(SanitizerUnitTests ${SANITIZER_TEST_NAME}
                        OBJECTS ${SANITIZER_TEST_OBJECTS}
                                ${SANITIZER_COMMON_LIB_NAME}
+                       DEPS ${SANITIZER_TEST_OBJECTS} ${SANITIZER_COMMON_LIB}
                        LINK_FLAGS ${SANITIZER_TEST_LINK_FLAGS})
 endmacro()
 





More information about the llvm-commits mailing list