@@ -11,12 +11,12 @@ if env['test_installed']:
1111 # build unit tests for the installed library
1212 env_test ['CPPPATH' ].remove (Dir ('..' ))
1313 env_test .PrependUnique (CPPPATH = env ['includedir' ], delete_existing = 1 )
14- env_test ['lib_includes' ] = []
1514 lib_dir = env ['libdir' ]
1615else :
17- # build unit tests for this code repository
16+ # link unit tests with our library.
1817 Import ('libdiffpy' )
1918 lib_dir = libdiffpy [0 ].dir .abspath
19+ use_our_library = not env ['test_installed' ]
2020
2121env_test .PrependUnique (LIBS = 'diffpy' , LIBPATH = lib_dir , delete_existing = 1 )
2222env_test .PrependUnique (LINKFLAGS = "-Wl,-rpath,%r" % lib_dir )
@@ -54,10 +54,13 @@ test_helpers = thobj + ['objcryst_helpers.cpp']
5454test_helpers = filter (srcsupported , test_helpers )
5555
5656alltests = env_test .CxxTest ('alltests' , test_sources + test_helpers )
57- Alias ('alltests' , [alltests , env ['lib_includes' ]])
57+ if use_our_library :
58+ env_test .Depends (alltests , libdiffpy )
59+
60+ env_test .Alias ('alltests' , alltests )
5861
5962# test -- alias for executing unit tests.
60- test = env_test .Alias ('test' , ' alltests' , alltests [0 ].abspath )
63+ test = env_test .Alias ('test' , alltests , alltests [0 ].abspath )
6164AlwaysBuild (test )
6265
6366# vim: ft=python
0 commit comments