To create an build target that creates an library, use the add_library command:
add_library(my_lib lib.cpp)
The CMake variable BUILD_SHARED_LIBS controls whenever to build an static (OFF) or an shared (ON) library, using for example cmake .. -DBUILD_SHARED_LIBS=ON. However, you can explicitly se...