<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Jun 6, 2014 at 6:08 AM, Brad King <span dir="ltr"><<a href="mailto:brad.king@kitware.com" target="_blank">brad.king@kitware.com</a>></span> wrote:<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">
I cannot reproduce these. Can you provide a complete CMakeLists.txt<br>
example please?<br><br></blockquote><div> </div></div>Attached (I hope the mailing list accepts attachments) is a demonstration of the problem. In creating it I discovered that a target created by add_executable does not seem to exhibit the problem. So the more exact situation is: using a generator expression to guard a list of more than one entry on target_link_libraries where the target itself is a library.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">Let me know if the attahced .zip doesn't make it. The .zip file contains the CMakeLists.txt, a helloworld program and a script to run through the iterations the output of which is:<div>
<br></div><div><div>$./run.sh </div><div><br></div><div>Testing linking to a single lib.</div><div>-- The C compiler identification is GNU 4.8.2</div><div>-- The CXX compiler identification is GNU 4.8.2</div><div>-- Check for working C compiler: /usr/bin/cc</div>
<div>-- Check for working C compiler: /usr/bin/cc -- works</div><div>-- Detecting C compiler ABI info</div><div>-- Detecting C compiler ABI info - done</div><div>-- Check for working CXX compiler: /usr/bin/c++</div><div>-- Check for working CXX compiler: /usr/bin/c++ -- works</div>
<div>-- Detecting CXX compiler ABI info</div><div>-- Detecting CXX compiler ABI info - done</div><div>-- Testing a single library guarded by a generator expression. This works.</div><div>-- Configuring done</div><div>-- Generating done</div>
<div>-- Build files have been written to: /home/afuller/src/slow/cmakelink/test/single</div><div>Scanning dependencies of target random</div><div>[ 50%] Building CXX object CMakeFiles/random.dir/random.cpp.o</div><div>Linking CXX static library librandom.a</div>
<div>[ 50%] Built target random</div><div>Scanning dependencies of target hello</div><div>[100%] Building CXX object CMakeFiles/hello.dir/helloworld.cpp.o</div><div>Linking CXX executable hello</div><div>[100%] Built target hello</div>
<div><br></div><div>Testing linking to multiple libs.</div><div>-- The C compiler identification is GNU 4.8.2</div><div>-- The CXX compiler identification is GNU 4.8.2</div><div>-- Check for working C compiler: /usr/bin/cc</div>
<div>-- Check for working C compiler: /usr/bin/cc -- works</div><div>-- Detecting C compiler ABI info</div><div>-- Detecting C compiler ABI info - done</div><div>-- Check for working CXX compiler: /usr/bin/c++</div><div>-- Check for working CXX compiler: /usr/bin/c++ -- works</div>
<div>-- Detecting CXX compiler ABI info</div><div>-- Detecting CXX compiler ABI info - done</div><div>-- Testing a list of libraries guarded by a generator expression. This leaks all but the first.</div><div>-- Configuring done</div>
<div>-- Generating done</div><div>-- Build files have been written to: /home/afuller/src/slow/cmakelink/test/multi</div><div>Scanning dependencies of target random</div><div>[ 50%] Building CXX object CMakeFiles/random.dir/random.cpp.o</div>
<div>Linking CXX static library librandom.a</div><div>[ 50%] Built target random</div><div>Scanning dependencies of target hello</div><div>[100%] Building CXX object CMakeFiles/hello.dir/helloworld.cpp.o</div><div>Linking CXX executable hello</div>
<div>/usr/bin/ld: cannot find -lsecondwindows.lib</div><div>collect2: error: ld returned 1 exit status</div><div>make[2]: *** [hello] Error 1</div><div>make[1]: *** [CMakeFiles/hello.dir/all] Error 2</div><div>make: *** [all] Error 2</div>
<div><br></div><div>Observing what happens with $<JOIN...> in an unused generator expression.</div><div>-- The C compiler identification is GNU 4.8.2</div><div>-- The CXX compiler identification is GNU 4.8.2</div><div>
-- Check for working C compiler: /usr/bin/cc</div><div>-- Check for working C compiler: /usr/bin/cc -- works</div><div>-- Detecting C compiler ABI info</div><div>-- Detecting C compiler ABI info - done</div><div>-- Check for working CXX compiler: /usr/bin/c++</div>
<div>-- Check for working CXX compiler: /usr/bin/c++ -- works</div><div>-- Detecting CXX compiler ABI info</div><div>-- Detecting CXX compiler ABI info - done</div><div>-- Testing $<JOIN:...> inside an inactive generator expression (you are building on Linux, right?). This plugs the leak.</div>
<div>-- Configuring done</div><div>-- Generating done</div><div>-- Build files have been written to: /home/afuller/src/slow/cmakelink/test/joinunused</div><div>Scanning dependencies of target random</div><div>[ 50%] Building CXX object CMakeFiles/random.dir/random.cpp.o</div>
<div>Linking CXX static library librandom.a</div><div>[ 50%] Built target random</div><div>Scanning dependencies of target hello</div><div>[100%] Building CXX object CMakeFiles/hello.dir/helloworld.cpp.o</div><div>Linking CXX executable hello</div>
<div>[100%] Built target hello</div><div><br></div><div>Observing what happens with $<JOIN...> in a used generator expression.</div><div>-- The C compiler identification is GNU 4.8.2</div><div>-- The CXX compiler identification is GNU 4.8.2</div>
<div>-- Check for working C compiler: /usr/bin/cc</div><div>-- Check for working C compiler: /usr/bin/cc -- works</div><div>-- Detecting C compiler ABI info</div><div>-- Detecting C compiler ABI info - done</div><div>-- Check for working CXX compiler: /usr/bin/c++</div>
<div>-- Check for working CXX compiler: /usr/bin/c++ -- works</div><div>-- Detecting CXX compiler ABI info</div><div>-- Detecting CXX compiler ABI info - done</div><div>-- Testing $<JOIN:...> inside an active generator expression (you are building on Linux, right?). Gives a CMake syntax error.</div>
<div>-- Configuring done</div><div>CMake Error:</div><div> Error evaluating generator expression:</div><div><br></div><div> $<JOIN:libXrandr.a></div><div><br></div><div> $<JOIN> expression requires 2 comma separated parameters, but got 1</div>
<div> instead.</div><div><br></div><div><br></div><div>CMake Error:</div><div> Error evaluating generator expression:</div><div><br></div><div> $<JOIN:libXrandr.a></div><div><br></div><div> $<JOIN> expression requires 2 comma separated parameters, but got 1</div>
<div> instead.</div><div><br></div><div><br></div><div>CMake Error:</div><div> Error evaluating generator expression:</div><div><br></div><div> $<JOIN:libXrandr.a></div><div><br></div><div> $<JOIN> expression requires 2 comma separated parameters, but got 1</div>
<div> instead.</div><div><br></div><div><br></div><div>CMake Error:</div><div> Error evaluating generator expression:</div><div><br></div><div> $<JOIN:libXrandr.a></div><div><br></div><div> $<JOIN> expression requires 2 comma separated parameters, but got 1</div>
<div> instead.</div><div><br></div><div><br></div><div>CMake Error:</div><div> Error evaluating generator expression:</div><div><br></div><div> $<JOIN:libXrandr.a></div><div><br></div><div> $<JOIN> expression requires 2 comma separated parameters, but got 1</div>
<div> instead.</div><div><br></div><div><br></div><div>CMake Error:</div><div> Error evaluating generator expression:</div><div><br></div><div> $<JOIN:libXrandr.a></div><div><br></div><div> $<JOIN> expression requires 2 comma separated parameters, but got 1</div>
<div> instead.</div><div><br></div><div><br></div><div>-- Generating done</div><div>-- Build files have been written to: /home/afuller/src/slow/cmakelink/test/joinused</div><div>$</div></div><div><br></div></div></div>