[PATCH] D19491: [test-suite] There is no need to check for name clashes explicitly.

Artem Belevich via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 25 12:48:15 PDT 2016


tra created this revision.
tra added a reviewer: MatzeB.
tra added a subscriber: llvm-commits.

cmake_minimum_required(VERSION 3.2) sets CMP0002 policy to NEW
which will produce an error when someone attempts to create a
new target with the same name.

When that happens llvm_target_prefix() can be used to ensure unique
names for targets within.

http://reviews.llvm.org/D19491

Files:
  cmake/modules/SingleMultiSource.cmake

Index: cmake/modules/SingleMultiSource.cmake
===================================================================
--- cmake/modules/SingleMultiSource.cmake
+++ cmake/modules/SingleMultiSource.cmake
@@ -34,16 +34,9 @@
   get_filename_component(name ${path} NAME )
   set(name "${TARGET_PREFIX}${name}")
 
-  list(FIND registered_executables ${name} name_idx)
+  set(${new_name} ${name} PARENT_SCOPE)
+  set_property(GLOBAL APPEND PROPERTY registered_executables ${name})
 
-  if(${name_idx} EQUAL -1)
-    set(${new_name} ${name} PARENT_SCOPE)
-    set_property(GLOBAL APPEND PROPERTY registered_executables ${name})
-    return()
-  endif()
-
-  message(FATAL_ERROR "Duplicate executable name!"
-    "Please set unique prefix with llvm_target_prefix().")
 endfunction()
 
 # Add flags to a cmake target property.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19491.54888.patch
Type: text/x-patch
Size: 812 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160425/60cd2a4f/attachment.bin>


More information about the llvm-commits mailing list