Moved setting CMAKE_OSX_DEPLOYMENT_TARGET at beginning of script file, otherwise the compilation process fails.