2 Copyright 2019 Dmitry Arkhipov
3 Distributed under the Boost Software License, Version 1.0. (See
4 accompanying file LICENSE_1_0.txt or copy at
5 http://www.boost.org/LICENSE_1_0.txt)
9 using pkg-config : : : <libdir>packages ;
10 using pkg-config : debug : : <libdir>packages <path>debug-packages ;
19 project : requirements <variant>debug:<pkg-config>debug ;
22 pkg-config.import debugged ;
23 pkg-config.import foobar : requirements <version>>=0.3 ;
24 pkg-config.import mangled : requirements <conditional>@mangle-name ;
27 [ pkg-config.import versioned
28 : usage-requirements <conditional>@versioned-api
32 [ pkg-config.import with-var
33 : usage-requirements <conditional>@var-to-define
37 # test if a package is found at all
38 run test1.cpp foobar ;
40 # test if conditional requirement is applied
43 : requirements <threading>single
49 : requirements <threading>multi
53 # test if pkg-config configuration is properly inferred from property set
54 run test3.cpp debugged
56 : requirements <variant>release
60 run test3.cpp debugged
62 : requirements <variant>debug
66 # test use of version method of pkg-config targets
67 run test4.cpp versioned ;
69 # test use of variable method of pkg-config targets
70 run test5.cpp with-var ;
73 rule mangle-name ( props * ) {
80 : [ property-set.create $(props) ]
82 return <name>$(name) ;
86 rule versioned-api ( props * ) {
87 local ps = [ property-set.create $(props) ] ;
88 local version = [ $(versioned).version $(ps) ] ;
89 if [ version.version-less $(version) : 2 ]
91 return <define>VERSIONED_API=1 ;
95 return <define>VERSIONED_API=2 ;
100 rule var-to-define ( props * ) {
101 local ps = [ property-set.create $(props) ] ;
102 local qwerty = [ $(with-var).variable qwerty : $(ps) ] ;
103 return <define>QWERTY=\\\"$(qwerty)\\\" ;