0

I have big project with cmake. It mostly works. But recently some combination of compilation server vs test server broke. Investigation found that final compile/link command calls gcc (...) -licudata -licui18n -licuuc (...), this introduces dependency on shared library which is not present on test server.

How do I find out what in my project (my library, imported library, found library, whatever) adds those 3 flags to compile command?

I don't add them explicitly, so something is done automagically and I want to find it. compile_commands.json doesn't have them because linking flags don't belong in it. CMakeCache.txt has those flags in some obscure variable PC_LIBXML_STATIC_LIBRARIES:INTERNAL but removing them there doesn't affect compile/link command.

Note that this question is not about dealing with libicu specifically but about a method for investigation in general (though comments about eventual known problems with libicu would be appreciated too).

MateuszL
  • 2,751
  • 25
  • 38
  • targets may and do introduce flags. If you are importing 3rd party, you can look for PkgConfig.cmake or FindPkg.cmake scripts (Pkg - package name as in `find_package`) and investigate what flags are added to those targets – Sergey Kolesnik Nov 17 '21 at 11:55
  • https://stackoverflow.com/a/56158485/9363996 this answer suggests a good debugging technique that is adding a custom command for targets and printing out flags. That way you can add efficiency to your investigation – Sergey Kolesnik Nov 17 '21 at 11:58

1 Answers1

0

I found out that dependency graphs created by cmake can have more details that was configured for our project. Here are all options: https://cmake.org/cmake/help/latest/module/CMakeGraphVizOptions.html I expect GRAPHVIZ_EXTERNAL_LIBS, GRAPHVIZ_SHARED_LIBS are most important to set to true.

We enabled everything that was possible to enable, filtered out nothing and resulting graph was massive (to big for xdot - luckily .dot files are human readable), but showed that Boost::regex uses those 3 libraries.

MateuszL
  • 2,751
  • 25
  • 38