<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 25, 2016 at 11:53 AM, Matthias Braun <span dir="ltr"><<a href="mailto:matze@braunis.de">matze@braunis.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div>BTW: Maybe you should reconsider the use of cmake_policy(SET CMP0002 NEW) instead of the custom error message? Contrary to the custom error message it tells you which target is duplicate:</div><div><br></div><div><div>CMake Error at CMakeLists.txt:3 (add_executable):</div><div> add_executable cannot create target "testtarget" because another target with the</div><div> same name already exists. The existing target is an executable created in</div><div> source directory "/Users/mbraun". See documentation for policy CMP0002 for</div><div> more details.</div></div><span class="gmail-HOEnZb"><font color="#888888"><div><br></div></font></span></div></blockquote><div><br></div><div>That policy is already set to NEW by cmake_minimum_required(VERSION 3.2) in the top-level CMakeLists.txt</div><div>We just need to remove explicit check whether target name is on registered_executables list.</div><div><br></div><div>Something like this: <a href="http://reviews.llvm.org/D19491">http://reviews.llvm.org/D19491</a></div><div><br></div><div>Now it would produce this error message for the name conflict in ARM:</div><div><div><br></div><div>CMake Error at cmake/modules/SingleMultiSource.cmake:130 (add_executable):</div><div> add_executable cannot create target "simple" because another target with</div><div> the same name already exists. The existing target is an executable created</div><div> in source directory</div><div> "/usr/local/google/home/tra/work/llvm-test-suite/SingleSource/UnitTests/Vector/NEON".</div><div> See documentation for policy CMP0002 for more details.</div><div>Call Stack (most recent call first):</div><div> cmake/modules/SingleMultiSource.cmake:168 (test_suite_add_executable)</div><div> SingleSource/UnitTests/Vector/CMakeLists.txt:21 (llvm_singlesource)</div></div><div><br></div><div>--Artem</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><span class="gmail-HOEnZb"><font color="#888888"><div></div><div>- Matthias</div></font></span><div><div class="gmail-h5"><br><div><blockquote type="cite"><div>On Apr 25, 2016, at 11:50 AM, Artem Belevich via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:</div><br><div><div dir="ltr" style="font-family:helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">I assume you were configuring for an ARM variant.<div>It appears that Vector and Vector/NEON both have files called simple.c and need to have unique prefix for their targets.<div><br></div><div>Fixed in r267439</div><div><br></div><div>--Artem<br><div><br></div><div><div><br></div></div></div></div></div><div class="gmail_extra" style="font-family:helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br><div class="gmail_quote">On Sat, Apr 23, 2016 at 2:15 PM, Chris Matthews<span> </span><span dir="ltr"><<a href="mailto:chris.matthews@apple.com">chris.matthews@apple.com</a>></span><span> </span>wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word">After this commit the test suite fails cmake for me:<div><br></div><div><br></div><div><pre style="white-space:pre-wrap;word-wrap:break-word;margin-top:0px;margin-bottom:0px;color:rgb(51,51,51)"><span title="CMake Error" style="color:white;background-color:red">CMake Error at cmake/modules/SingleMultiSource.cmake:45 (message):
</span> Duplicate executable name!Please set unique prefix with
llvm_target_prefix().
Call Stack (most recent call first):
cmake/modules/SingleMultiSource.cmake:136 (get_unique_exe_name)
cmake/modules/SingleMultiSource.cmake:175 (test_suite_add_executable)
SingleSource/UnitTests/Vector/CMakeLists.txt:21 (llvm_singlesource)
</pre><div><div><div><br></div><div><br></div><div><blockquote type="cite"><div>On Apr 22, 2016, at 3:53 PM, Artem Belevich via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:</div><br><div><div>Author: tra<br>Date: Fri Apr 22 17:53:21 2016<br>New Revision: 267243<br><br>URL:<span> </span><a href="http://llvm.org/viewvc/llvm-project?rev=267243&view=rev">http://llvm.org/viewvc/llvm-project?rev=267243&view=rev</a><br>Log:<br>[test-suite] Added llvm_target_prefix() command to set unique target prefix.<br><br>Differential Revision:<span> </span><a href="http://reviews.llvm.org/D19423">http://reviews.llvm.org/D19423</a><br><br>Modified:<br> test-suite/trunk/SingleSource/Benchmarks/Shootout-C++/CMakeLists.txt<br> test-suite/trunk/SingleSource/Benchmarks/Shootout/CMakeLists.txt<br> test-suite/trunk/SingleSource/Regression/C++/CMakeLists.txt<br> test-suite/trunk/SingleSource/Regression/C/CMakeLists.txt<br> test-suite/trunk/cmake/modules/SingleMultiSource.cmake<br><br>Modified: test-suite/trunk/SingleSource/Benchmarks/Shootout-C++/CMakeLists.txt<br>URL:<span> </span><a href="http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/Shootout-C%2B%2B/CMakeLists.txt?rev=267243&r1=267242&r2=267243&view=diff">http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/Shootout-C%2B%2B/CMakeLists.txt?rev=267243&r1=267242&r2=267243&view=diff</a><br>==============================================================================<br>--- test-suite/trunk/SingleSource/Benchmarks/Shootout-C++/CMakeLists.txt (original)<br>+++ test-suite/trunk/SingleSource/Benchmarks/Shootout-C++/CMakeLists.txt Fri Apr 22 17:53:21 2016<br>@@ -1,3 +1,4 @@<br>+llvm_target_prefix("shootout-cxx")<br>list(APPEND CXXFLAGS -Wno-deprecated)<br>list(APPEND CPPFLAGS -Wno-deprecated)<br>set(FP_TOLERANCE 0.00000001)<br><br>Modified: test-suite/trunk/SingleSource/Benchmarks/Shootout/CMakeLists.txt<br>URL:<span> </span><a href="http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/Shootout/CMakeLists.txt?rev=267243&r1=267242&r2=267243&view=diff">http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/Shootout/CMakeLists.txt?rev=267243&r1=267242&r2=267243&view=diff</a><br>==============================================================================<br>--- test-suite/trunk/SingleSource/Benchmarks/Shootout/CMakeLists.txt (original)<br>+++ test-suite/trunk/SingleSource/Benchmarks/Shootout/CMakeLists.txt Fri Apr 22 17:53:21 2016<br>@@ -1,3 +1,4 @@<br>+llvm_target_prefix("shootout")<br>list(APPEND LDFLAGS -lm)<br>if(ARCH STREQUAL "XCore")<br> set(XCORE_TARGET_NEEDS_MEMORY 256)<br><br>Modified: test-suite/trunk/SingleSource/Regression/C++/CMakeLists.txt<br>URL:<span> </span><a href="http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Regression/C%2B%2B/CMakeLists.txt?rev=267243&r1=267242&r2=267243&view=diff">http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Regression/C%2B%2B/CMakeLists.txt?rev=267243&r1=267242&r2=267243&view=diff</a><br>==============================================================================<br>--- test-suite/trunk/SingleSource/Regression/C++/CMakeLists.txt (original)<br>+++ test-suite/trunk/SingleSource/Regression/C++/CMakeLists.txt Fri Apr 22 17:53:21 2016<br>@@ -1,3 +1,4 @@<br>+llvm_target_prefix("regression-cxx")<br>list(APPEND LDFLAGS -lstdc++)<br>llvm_singlesource()<br><br><br>Modified: test-suite/trunk/SingleSource/Regression/C/CMakeLists.txt<br>URL:<span> </span><a href="http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Regression/C/CMakeLists.txt?rev=267243&r1=267242&r2=267243&view=diff">http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Regression/C/CMakeLists.txt?rev=267243&r1=267242&r2=267243&view=diff</a><br>==============================================================================<br>--- test-suite/trunk/SingleSource/Regression/C/CMakeLists.txt (original)<br>+++ test-suite/trunk/SingleSource/Regression/C/CMakeLists.txt Fri Apr 22 17:53:21 2016<br>@@ -1,3 +1,4 @@<br>+llvm_target_prefix("regression-c")<br>if(ARCH STREQUAL "x86")<br> if(DEFINED USE_REFERENCE_OUTPUT)<br> set(EXEC_XFAILS casts)<br><br>Modified: test-suite/trunk/cmake/modules/SingleMultiSource.cmake<br>URL:<span> </span><a href="http://llvm.org/viewvc/llvm-project/test-suite/trunk/cmake/modules/SingleMultiSource.cmake?rev=267243&r1=267242&r2=267243&view=diff">http://llvm.org/viewvc/llvm-project/test-suite/trunk/cmake/modules/SingleMultiSource.cmake?rev=267243&r1=267242&r2=267243&view=diff</a><br>==============================================================================<br>--- test-suite/trunk/cmake/modules/SingleMultiSource.cmake (original)<br>+++ test-suite/trunk/cmake/modules/SingleMultiSource.cmake Fri Apr 22 17:53:21 2016<br>@@ -13,18 +13,27 @@<br><br>include(TestFile)<br><br>+<br>+# Set unique target prefix within caller's scope.<br>+function(llvm_target_prefix prefix)<br>+ if(prefix)<br>+ set(TARGET_PREFIX "${prefix}-" PARENT_SCOPE)<br>+ else()<br>+ set(TARGET_PREFIX "" PARENT_SCOPE)<br>+ endif()<br>+endfunction()<br>+<br># Given a source file name after which a test should be named, create a unique<br># name for the test. Usually this is just the source file with the suffix<br>-# stripped, but in some cases this ends up causing duplicates so attempt to<br>-# make each unique (by adding pathname segments until they become unique).<br>-#<br>-# FIXME: Swap this with a simpler procedure to just append a numeral<br>+# stripped, and ${TARGET_PREFIX} prepended.<br>set_property(GLOBAL PROPERTY registered_executables)<br>function(get_unique_exe_name new_name main_src)<br> get_property(registered_executables GLOBAL PROPERTY registered_executables)<br><br> string(REGEX REPLACE ".[cp]+$" "" path ${main_src})<br>- string(REGEX REPLACE ".*/" "" name ${path})<br>+ get_filename_component(name ${path} NAME )<br>+ set(name "${TARGET_PREFIX}${name}")<br>+<br> list(FIND registered_executables ${name} name_idx)<br><br> if(${name_idx} EQUAL -1)<br>@@ -33,20 +42,8 @@ function(get_unique_exe_name new_name ma<br> return()<br> endif()<br><br>- # There is a clash. Rename the target. Each time around the loop pull in<br>- # a new path component.<br>- foreach(n RANGE 1 4)<br>- string(REGEX REPLACE ".*/([^/]+/${name})" "<a>\\1</a>" name ${path})<br>- string(REGEX REPLACE "/" "-" safe_name ${name})<br>-<br>- list(FIND registered_executables ${safe_name} name_idx)<br>- if(${name_idx} EQUAL -1)<br>- set(${new_name} ${safe_name} PARENT_SCOPE)<br>- set_property(GLOBAL APPEND PROPERTY registered_executables ${safe_name})<br>- return()<br>- endif()<br>- endforeach()<br>- message(FATAL_ERROR "Failed to uniquify executable name!")<br>+ message(FATAL_ERROR "Duplicate executable name!"<br>+ "Please set unique prefix with llvm_target_prefix().")<br>endfunction()<br><br># Add flags to a cmake target property.<br><br><br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br></div></div></blockquote></div><br></div></div></div></div></blockquote></div><br><br clear="all"><div><br></div>--<span> </span><br><div><div dir="ltr">--Artem Belevich</div></div></div><span style="font-family:helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline">_______________________________________________</span><br style="font-family:helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline">llvm-commits mailing list</span><br style="font-family:helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="mailto:llvm-commits@lists.llvm.org" style="font-family:helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">llvm-commits@lists.llvm.org</a><br style="font-family:helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" style="font-family:helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a></div></blockquote></div><br></div></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">--Artem Belevich</div></div>
</div></div>