[CMake] Fake dependencies of executables to static libs

Francis Giraldeau francis.giraldeau at gmail.com
Thu Apr 4 13:48:54 EDT 2019


Maybe the problem is related to Cotire? I see that it is used in
mredis. I tried to reproduce the issue, and it behaves correctly. You
might want to try to reproduce using the following minimal repo:

  https://gitlab.com/fgiraldeau/cotire-demo

Francis

Le jeu. 4 avr. 2019 à 03:17, Stephan Menzel <stephan.menzel at gmail.com> a écrit :
>
> Hello Paul and Shoaib,
>
> I'm answering to the both of you.
>
> On Thu, Apr 4, 2019 at 7:13 AM Paul Smith <paul at mad-scientist.net> wrote:
>>
>> Now although I don't understand the exact reasons behind that, over the years came to accept that depedencies between the lib and the resulting artifcats are not working. Like, when I change a source file to mylib, the lib will get rebuilt but the resulting test tool won't be relinked.
>>
>>
>> This is definitely not true, as stated. I feel like I must be missing something about your stated environment because this is really basic, fundamental CMake behavior, which has always worked.
>
>
> First of all, thanks for the information. I was not aware that this is supposed to work. As I said, I've been struggling with this issue for years now and I recall posting this to this list too but the only explanation I ever found was something along the lines of "dependencies would exist to objects inside the lib, not the lib as it is a static archive". But I'm pulling this out of my 'memory' now, nothing to rely on. All I remembered is that this is not supposed to work. But now you say the opposite, which gives me a little hope.
>
>>
>> If in your environment you are not seeing executables rebuilt when libraries they depend on are updated, then there is something more complex about it than the straightforward case you provide above.
>
>
> I have seen this in two major projects I have been working on in the last years. Both were Linux and Windows, MSVC 14 and 15 on Windows. And I do believe the issue is on Windows. I am not sure which CMake version I have seen this first on. Let's make it 3.10.x cause this was when I posted this to the list last time but by then I was already having the problem for a longer time.
>
> Today I am using CMake version 3.13.2 but I have been using many different versions up to this one.
>
> Both projects were large but not huge, having about 10 - 15 targets plus additional 50 unit tests plus another 5 test tools. Unfortunately I cannot publish the projects themselves but one that I currently see the issue with is mredis (https://github.com/MrMoose/mredis) which, among others, is pulled in as a submodule. C++ only, some protobuf code generation is involved but not in the targets that I'm talking about.
>
> Since the issue has been persisting for so long now, the projects and CMakeLists have substantially changed many times, so it's really hard to come up with something I would consider 'strange' or 'different' as a possible explanation.
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list