COMP: conditionally search for Teem library

The existing code works to build the UKF slicer extension
and the new search code might not work when built as a
slicer extension, so use the old behavior if the
extension is being built.