<html><head></head><body>Are you sure you hit the right build menu item? Maybe you are just building the current target. At least that would explain it. In MSVC you must either build the solution or the ALL_BUILD target for this to work.<br>
<br><br><div class="gmail_quote">Am 28. Juni 2018 16:07:33 MESZ schrieb Stephan Menzel <stephan.menzel@gmail.com>:<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div dir="ltr">Hello CMake community,<div><br></div><div>I am observing a strange problem regarding dependencies to static libs in executables. I am not entirely sure but it seems this started since I upgraded to the 3.11 line. I am using Windows and MSVC14.</div><div><br></div><div>Basically, my code base contains a number of static libraries that are linked together to a few executables. Very basic and down to earth. Like this:</div><div><br></div><div><div>set(MY_SERVER_SRC</div><div><span style="white-space:pre"> </span>ServerSource1.cpp</div><div><span style="white-space:pre"> </span>ServerSource2.cpp<span style="white-space:pre"> </span></div><div><span style="white-space:pre"> </span>)</div><div><br></div><div>set(MY_SERVER_HDR</div><div><span style="white-space:pre"> </span>ServerConfig.hpp</div><div><span style="white-space:pre"> </span>Header1.hpp</div><div><span style="white-space:pre"> </span>Header2.hpp</div><div><span style="white-space:pre"> </span>)</div></div><div><br></div><div>add_library(my_server STATIC ${MY_SERVER_SRC} ${MY_SERVER_HDR})</div><div><div>target_link_libraries(my_server </div><div><span style="white-space:pre"> </span>some_tools</div><div><span style="white-space:pre"> </span>some_base</div><div><span style="white-space:pre"> </span>${Boost_LIBRARIES}</div><div><span style="white-space:pre"> </span>${OPENSSL_LIBRARIES}</div><div>)</div><div><span style="white-space:pre"> </span></div><div>add_executable(serverd main.cpp)</div><div>target_link_libraries(serverd </div><div><span style="white-space:pre"> </span>my_server </div><div><div><span style="white-space:pre"> </span>some_tools</div><div><span style="white-space:pre"> </span>some_base</div></div><div><br></div><div><span style="white-space:pre"> </span>${Boost_LIBRARIES}</div><div><span style="white-space:pre"> </span>${OPENSSL_LIBRARIES}</div><div>)</div></div><div><br></div><div>So a few big libs with the beef in them and then a small main.cpp containing executable. Nothing fancy.</div><div><br></div><div>What gives me trouble now is that dependencies within that seem broken. In above example, when I edit ServerSource1.cpp and then hit "Build", I see ServerSource1.o being compiled and the library my_server being linked. Like expected. Problem is, serverd does not get linked. Or at least I see no hint of it being linked (In MSVC's output window).</div><div>So, my question is: What could cause this? I there anything 3.11.x does differently which causes those dependecies to break? And how can I fix this?</div><div><br></div><div>This is quickly turning into a major problem for us here as it means that we cannot reliably build anymore because whenever we change something and hit build we can't be sure we get a linked executable anymore unless we do a complete rebuild, which takes a long time (In fact, I wrote this message waiting for one).</div><div><br></div><div>Thanks for any hint!</div><div><br></div><div>Stephan</div><div><br></div><div><br></div></div>
</blockquote></div></body></html>