Missing stdafx.h after configuring with cmake of sdk

the optix_hello looks for the ptx and fails when it doesnt find it.

Again, if you ask a question on any developer forum about errors, you should at least spend enough time to copy-and-paste the exact error message into your question.
It’s unclear why something is not found again and I can think of multiple reasons.

I added in configuration - cuda/c++/nvcc compilation type - generate ptx

There is no need to change any code inside the CMakeLists.txt files or the MSVS solution settings after it was built.

The optixHello program inside the OptiX SDK 5.1.0 uses only the draw_color.cu file.
The default settings for the OptiX SDK 5.1.0 examples is to translate the *.cu files to *.ptx files at runtime using the NVRTC (NVIDIA CUDA Runtime Compiler) instead of the NVCC (NVIDIA CUDA Compiler) at build time.

Either the NVRTC is not working (most likely because CUDA 7.0 is too old), it’s not finding the *.cu file, or you compiled them at build time and the *.ptx files are not found, because you didn’t run the programs where they have been originally built.

CUDA 7.0 is too old to be used with NVRTC. That contains this functionality as beta only and the code was not optimally translated before CUDA 8.0 when using NVRTC.

Inside the CMake GUI there is a variable named CUDA_NVRTC_ENABLED which you can uncheck to let the *.ptx source be generated with NVCC at compile time, if NVRTC is not working on your development machine, or you don’t want to use that.

There should be a file named optixHello_generated_draw_color.cu.ptx produced when using the NVCC compiler, which your self-built executable should find when run from its build folder.

If you copy stuff to different locations, you would need to set two environment variables to find the *.ptx and data.
https://forums.developer.nvidia.com/t/sdk-samples-sutil-getptxstring-file-path/70963/2

Please, again, seriously(!), upgrade your development environment software to something more modern:
For OptiX 5.1.0:MSVS 2017 and CUDA 9.0,
For OptiX 6.5.0:MSVS 2017 or 2019 and CUDA 10.1.
For OptiX 7.x: MSVS 2017 or 2019 and CUDA 10.x or CUDA 11.x.