fix CMakeLists.txt on Mac/Linux when using BUILD_SHARED_LIBS