build: fixing bug with detection of installed boost libraries

Thanks to Menghan Li for reporting the bug