Skip to content

When using wraps, How To link a binary to static libraries #12754

Answered by eli-schwartz
andy5995 asked this question in Q&A
Discussion options

You must be logged in to vote
phyfs_dep = dependency('physfs', required: false)
if not phyfs_dep.found()
  phyfs_dep = cc.find_library('physfs', has_headers: 'physfs.h', required: false)
  if not phyfs_dep.found()
    # This will use the fallback
    phyfs_dep = dependency('physfs')
    # or
    phyfs_dep = dependency(
      'physfs',
      required: false,
      fallback: 'physfs',
      default_options: ['default_library=static']
      )
  endif
endif
deps += phyfs_dep

So what you're doing here is 4 lookups:

  • dependency (external, optional)
  • find_library(external, optional)
  • dependency (mandattory)
  • dependency (subproject fallback, optional)

Only if the number 4 lookup is the one that gets found, does the default_opti…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@andy5995
Comment options

@eli-schwartz
Comment options

@andy5995
Comment options

@andy5995
Comment options

Answer selected by andy5995
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants