Fix compilation on linux with BUILD_LIBRARIES_ONLY