The default value of required is true for dependencies.
This commit is contained in:
parent
0d2f34654c
commit
852b774e2e
|
@ -155,7 +155,9 @@ class ExternalLibrary(Dependency):
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def find_external_dependency(name, kwargs):
|
def find_external_dependency(name, kwargs):
|
||||||
required = kwargs.get('required', False)
|
required = kwargs.get('required', True)
|
||||||
|
if not isinstance(required, bool):
|
||||||
|
raise DependencyException('Keyword "required" must be a boolean.')
|
||||||
if name in packages:
|
if name in packages:
|
||||||
dep = packages[name](kwargs)
|
dep = packages[name](kwargs)
|
||||||
if required and not dep.found():
|
if required and not dep.found():
|
||||||
|
|
|
@ -4,8 +4,8 @@ project('boosttest', 'cxx')
|
||||||
# within one project. The need to be independent of each other.
|
# within one project. The need to be independent of each other.
|
||||||
# Use one without a library dependency and one with it.
|
# Use one without a library dependency and one with it.
|
||||||
|
|
||||||
nolinkdep = find_dep('boost', modules: 'utility', required : true)
|
nolinkdep = find_dep('boost', modules: 'utility')
|
||||||
linkdep = find_dep('boost', modules : 'thread', required : true)
|
linkdep = find_dep('boost', modules : 'thread')
|
||||||
|
|
||||||
nolinkexe = executable('nolinkedexe', 'nolinkexe.cc', deps : nolinkdep)
|
nolinkexe = executable('nolinkedexe', 'nolinkexe.cc', deps : nolinkdep)
|
||||||
linkexe = executable('linkedexe', 'linkexe.cc', deps : linkdep)
|
linkexe = executable('linkedexe', 'linkexe.cc', deps : linkdep)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
project('gtest', 'cxx')
|
project('gtest', 'cxx')
|
||||||
|
|
||||||
gtest = find_dep('gtest', required : true)
|
gtest = find_dep('gtest')
|
||||||
|
|
||||||
e = executable('testprog', 'test.cc', deps : gtest)
|
e = executable('testprog', 'test.cc', deps : gtest)
|
||||||
add_test('gtest test', e)
|
add_test('gtest test', e)
|
||||||
|
|
|
@ -3,8 +3,8 @@ project('gmock test', 'cxx')
|
||||||
# Using gmock without gtest is a pain so just
|
# Using gmock without gtest is a pain so just
|
||||||
# don't support that then.
|
# don't support that then.
|
||||||
|
|
||||||
gtest = find_dep('gtest', required : true)
|
gtest = find_dep('gtest')
|
||||||
gmock = find_dep('gmock', required : true)
|
gmock = find_dep('gmock')
|
||||||
|
|
||||||
e = executable('gmocktest', 'gmocktest.cc', deps : [gtest, gmock])
|
e = executable('gmocktest', 'gmocktest.cc', deps : [gtest, gmock])
|
||||||
add_test('gmock test', e)
|
add_test('gmock test', e)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
project('qt5 build test', 'cxx')
|
project('qt5 build test', 'cxx')
|
||||||
|
|
||||||
qt5dep = find_dep('qt5', modules : 'Widgets', required : true)
|
qt5dep = find_dep('qt5', modules : 'Widgets')
|
||||||
|
|
||||||
q5exe = executable('qt5test',
|
q5exe = executable('qt5test',
|
||||||
sources : ['main.cpp', 'mainWindow.cpp'], # Sources that don't need preprocessing.
|
sources : ['main.cpp', 'mainWindow.cpp'], # Sources that don't need preprocessing.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
project('protocol buffer test', 'cxx')
|
project('protocol buffer test', 'cxx')
|
||||||
|
|
||||||
protoc = find_program('protoc', required : true)
|
protoc = find_program('protoc', required : true)
|
||||||
dep = find_dep('protobuf', required : true)
|
dep = find_dep('protobuf')
|
||||||
|
|
||||||
gen = generator(protoc, \
|
gen = generator(protoc, \
|
||||||
outputs : ['@BASENAME@.pb.cc', '@BASENAME@.pb.h'],
|
outputs : ['@BASENAME@.pb.cc', '@BASENAME@.pb.h'],
|
||||||
|
|
|
@ -2,7 +2,11 @@ project('external dependency', 'c')
|
||||||
|
|
||||||
# Zlib is probably on all dev machines.
|
# Zlib is probably on all dev machines.
|
||||||
|
|
||||||
dep = find_dep('zlib', required : true)
|
dep = find_dep('zlib')
|
||||||
exe = executable('zlibprog', 'prog.c', deps : dep)
|
exe = executable('zlibprog', 'prog.c', deps : dep)
|
||||||
|
|
||||||
add_test('zlibtest', exe)
|
add_test('zlibtest', exe)
|
||||||
|
|
||||||
|
# Try to find a nonexistant library to ensure requires:false works.
|
||||||
|
|
||||||
|
dep = find_dep('nvakuhrabnsdfasdf', required : false)
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
project('nsstring', 'objc')
|
project('nsstring', 'objc')
|
||||||
|
|
||||||
if host.name() == 'darwin'
|
if host.name() == 'darwin'
|
||||||
dep = find_dep('appleframeworks', modules : 'foundation', required : true)
|
dep = find_dep('appleframeworks', modules : 'foundation')
|
||||||
else
|
else
|
||||||
dep = find_dep('gnustep', required : true)
|
dep = find_dep('gnustep')
|
||||||
endif
|
endif
|
||||||
exe = executable('stringprog', 'stringprog.m', deps : dep)
|
exe = executable('stringprog', 'stringprog.m', deps : dep)
|
||||||
add_test('stringtest', exe)
|
add_test('stringtest', exe)
|
||||||
|
|
Loading…
Reference in New Issue