Skip to content

Commit aa059f2

Browse files
committed
Require ObjCryst when enable_objcryst is set.
Exit with build error if enable_objcryst is true and ObjCryst cannot be found. Use conditional linking with ObjCryst if enable_objcryst was not set.
1 parent 41b7f1e commit aa059f2

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

SConstruct

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ install-include install the C++ header files
1111
install-data install data files used by the library
1212
alltests build the unit test program "alltests"
1313
test execute unit tests (requires the cxxtest framework)
14-
sdist create source distribution tarball (requires git repo)
14+
sdist create source distribution tarball from git repository
1515
1616
Build configuration variables:
1717
%s
@@ -68,7 +68,7 @@ vars.Add(PathVariable('datadir',
6868
env['prefix'] + '/share',
6969
PathVariable.PathAccept))
7070
vars.Add(BoolVariable('enable_objcryst',
71-
'enable objcryst support, when installed', True))
71+
'enable objcryst support, when installed', None))
7272
vars.Update(env)
7373
env.Help(MY_SCONS_HELP % vars.GenerateHelpText(env))
7474

src/SConscript.configure

+12-4
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,18 @@ if not conf.CheckBoostVersion(boost_required):
5555
# boost_serialization
5656
configure_boost_library('boost_serialization')
5757

58-
# check for ObjCryst, autoadd appends to LIBS if found.
59-
conf.env['has_objcryst'] = (conf.env['enable_objcryst'] and
60-
conf.CheckLibWithHeader('ObjCryst', 'ObjCryst/ObjCryst/Crystal.h',
61-
language='C++', autoadd=True))
58+
# ObjCryst - assume a no-objcryst fallback configuration.
59+
conf.env['has_objcryst'] = False
60+
# Detect ObjCryst and exit with error if requested and not found.
61+
# By default conf.env does not contain the 'enable_objcryst' key.
62+
if conf.env.get('enable_objcryst', True):
63+
conf.env['has_objcryst'] = conf.CheckLibWithHeader(
64+
'ObjCryst', 'ObjCryst/ObjCryst/Crystal.h',
65+
language='C++', autoadd=True)
66+
objcryst_requested = conf.env.get('enable_objcryst', False)
67+
if objcryst_requested and not conf.env['has_objcryst']:
68+
print('Adjust compiler paths or build with "enable_objcryst=False".')
69+
Exit(1)
6270

6371
env = conf.Finish()
6472

0 commit comments

Comments
 (0)