Closed SpaceIm closed 4 years ago
Hi @SpaceIm
yes, the deps_cpp_info
has a system_libs
attribute! Is that what you are looking for?
class HelloConan(ConanFile):
requires = "poco/1.9.4"
def build(self):
system_libs = self.deps_cpp_info.system_libs
print("SYSTEM LIBS %s" % system_libs)
Prints something like
SYSTEM LIBS ['iphlpapi', 'crypt32', 'msi', 'ws2_32', 'advapi32', 'user32', 'gdi32']
As a side note, I have been having a look at NMake, seeing if this could be better automated, but couldn't find anything better, there are no defined env-vars, not a way to define files, or standard variables...
How ! Thanks a lot. I missed that. It's exactly what I was looking for.
I'm creating a recipe for
GDAL
in CCI: https://github.com/conan-io/conan-center-index/pull/1722GDAL
has two build systems:NMake
for Visual StudioAutotools
for all othersMy question is about
Visual Studio
and how to properly inject informations about required system libs.Currently I'm using
tools.vcvars(self.settings)
andVisualStudioBuildEnvironment
:If at least one GDAL's dependency or transitive dependency depends on a system lib (such as
user32
,crypt32
etc) which are not direct dependencies ofGDAL
(ie explicitly linked in GDAL's NMake files), creation of sharedGDAL
fails (and also, static lib fails to link into GDAL's executables in NMake process) with undefined reference to symbols defined in those system libs.I can manually inject those system libs by patching GDAL's NMake files like this (by listing union of all possible system libs of all possible dependency trees of GDAL):
and rely on others commands in GDAL's NMake files, like here:
It works as a workaround, but it might break if a dependency suddenly decide to depend on another system lib. It's very fragile.
Is there a better way to properly inject those system libs using conan? Is there a way to have the list of system libs through
deps_cpp_info
, loop into all the dependency tree and inject this information?