A building is a specialized unit that is usually large and stationary. There are different levels of gameplays in the game and in many gameplays, the destruction of all your buildings is sufficient for your defeat. The functions of buildings usually include the production of new units or the enabling of certain unit abilities.
There is also an element of systematic constructions of buildings in the game. This is also usually referred to as tree or tech tree. The tree, or tech tree, is the set of dependencies between buildings and between buildings and units. An example of the first kind is the fact that you must build a Castle before you can build any other building. An example of the second kind is the fact that you must have army training camps or barracks before you can train troops. Note that these dependencies are a kind of constraint and requires strategic and analytical thinking, and this also represent the "build" part of RTS model.
Base building is so much more engaging if the actual placement of structures is nuanced and meaningful, rather than just a way of spending resources and advancing through a tech tree. Most RTS fans do enjoy base building regardless of if the positioning is meaningful. Moreover, the enjoyment also comes from a feeling of sandbox creativity and a visual representation of the economic, tech and production progression that happens throughout the gameplay.