[CMake] Redundant linking when modifying shared libraries

Robert Maynard robert.maynard at kitware.com
Thu Feb 14 16:26:11 EST 2019


I agree that we should document this property better.
I recommend looking at the CMake wiki (
https://gitlab.kitware.com/cmake/community/wikis/home ) and thinking
maybe adding a new recipe for `optimizing redundant linking`.

On Thu, Feb 14, 2019 at 3:11 PM Itay Chamiel <itay.chamiel at orcam.com> wrote:
>
> On Thu, Feb 14, 2019 at 8:08 PM Robert Maynard
> <robert.maynard at kitware.com> wrote:
> > By default CMake wants to get a correct build 100% of the time. There
> > is nothing to stop people from having functions defined in a .cxx file
> > with no corresponding header, and using manual forward deceleration is
> > used in a consuming library/executable. By setting
> > `LINK_DEPENDS_NO_SHARED` to `True` you will convert what was a link
> > time error ( renaming the function in the .cxx ) to a run time error.
>
> First of all, thanks for the answer - it's good to understand the
> rationale and to know that in our use case we can safely use this
> setting.
>
> On the question of whether to set this as the default, I understand
> your position and I personally disagree - but do not wish to start a
> debate. However I will say that this simple change has, in a common
> case, reduced my build time from 5 minutes to 15 seconds. At the very
> least could you consider steps to make this setting more known and
> accessible? (No one on Stack Overflow knew about it, and I think
> that's saying something.) Perhaps put it in a FAQ, and/or more
> prominently in the documentation.
>
> Kind regards,
>
> itay
> --
>
> 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