How should I define OPTIX_SAMPLE_NAME and OPTIX_SAMPLE_DIR in my own optix-based app?

This practice is not very handy as everytime I want to change something in the kernel, I have to go back to the modified optixTriangle sample solution, apply changes, rebuild and copy again manually the .optixir file to my own optix solution folder.

That’s shouldn’t be necessary at all when setting up a standalone solution with all source files required to build your application.

The magic scenario would be to include the .cu file in my own solution, generate the .optixir file and place at the right folder by just building my solution.

Exactly!

If you use CMake instead to build the MSVS solution, the process to do that is described inside the links I provided.

If you want to use the CUDA Visual Studio Integration, you MUST change the compilation of the input *.cu files to a translation to *.ptx or *.optixir.
You MUST NOT compile the OptiX device code to CUDA object code like you’re doing above.
Read the nvcc.exe --help output for the necessary command line arguments.

Seriously, both of these things are explained inside the two links I already provided.
You are doing exactly the same error as in this thread:
https://forums.developer.nvidia.com/t/converting-vs-property-sheet-into-cmake-settings/287159
This one even links to a thread where I explained the same thing to you before:
https://forums.developer.nvidia.com/t/code-organization-and-cmake/290506