cmake: add ENABLE_SHARED build option for creating a shared library (dll/so)
cmake: use add_definitions() instead of modifying CMAKE_CXX_FLAGS manually