The European Union was not created in the form it takes now. It has developed by stages, through a series of treaties agreed unanimously and ratified by its member states.
Single European Act
Treaty of Amsterdam
Treaty of Nice
There is a second, parallel development of the European Union which has been underway at the same time, namely the enlargement of the EU to include new member states. Follow the links here to read about the membership debate in different European countries.