All animals instinctively associate fire with danger. So did man at one time in the dark and distant past. When man learned to create an control fire, he learned to control his fear of it. On the whole, animals have not learned that degree of control. The exception being domesticated animals such as pet dogs. They're still scared of fire, but will tolerate a camp fire because their master (pack leader) shows no fear.
Bears and other wild animals will move away from the smell of woodsmoke because they asociate it with forest fires. We know that even traditional enemies such as wolves and deer will co-exist without attack during a forest fire - at least until the danger is over, simply because the fire is a greater danger than the animal preditor.
So, nearly all animals will avoid your camp site if you have a fire going. It doesn't have to be a big fire, a simple cooking fire will suffice. The fact that it is producing woodsmoke and the associated fear triggering smell will do the trick.
Bears will avoid the camp, but the smell of food may override their fear of the fire, especially if their past experiences tell them that that type of fire won't burn them up, and they may well get a meal at the same time. That's the problem man has given himself, feeding the nice cuddly bears from the safety of their car, then complaining when they enter the camp expecting to be fed.
The answer therefore is, have a normal cooking fire, burn any scraps of food left after the meal, wash your pots straight away and cache your food, well away from the camp and above bear reaching height. By well away, I'd say no less than a couple of hundred metres. On proper camp sites, there should be bear proof metal boxes to store your food in, but in wilderness areas, sling a rope between two trees and haul your food up so it hangs in the middle.
Also, regardles of how tempting, don't keep snack and bars of chocolate in your tent for a midnight snack, or you might find yourself becoming the snack instead.
Common sense is the answer here. Don't give the bears an excuse to come anywhere near you and that, and the coimbination of fire should keep you safe.
I wouldn't worry about large herbivores like moose either, they'll avoid you like the plague and will smell you long before you see them.
Eric