cmake build should allow both static and shared libraries to be built
The old autoconf build allowed both static and shared libraries to be built. The present cmake configuration does not offer this option. Perhaps it should so that people stop complaining that autoconf support was dropped.
A possible template is geographiclib. By default the BUILD_SHARED_LIBS is use to select shared vs static. However BUILD_BOTH_LIBS=ON forces both types of libraries to be built. Needless to say, this gets a little complicated when dealing with Windows builds: you need to use target_compile_definitions to pass a preprocessor flag which depends on which version of the library you're linking against.
This was discussed at (and below) https://github.com/OSGeo/PROJ/issues/2546#issuecomment-785389755
I don't really see the benefit of bending CMake to implement that. The fact that autotools did static & dynamic at the same time is rather arbitrary. Why didn't it do "-g -O0" and "-O2" builds concurrently ? The workaround of building twice is IMHO good enough for people who really need both static and shared libs to be built