Home Depot sells containers of activated charcoal which is meant for taking out strong odors. Put the books (separated and open, if you can) in a big plastic box or closet with the open container of charcoal for a couple of weeks. If it takes out the smell of old cat urine, surely it can take out smoke!