[SYCL][sycl-rel] Fix AddSecurityFlags having no side effects (#17796)
This is a cherry-pick of intel/llvm#17690
---
CMake has a notion of scopes for variables and we fell into a pitfall of
setting local variables instead of applying changes globally to the
whole project.
For reference, see:
- https://cmake.org/cmake/help/v3.20/command/set.html
- https://cmake.org/cmake/help/v3.20/command/include.html