Failed to configure OptiX samples using cmake 3.12.3

All,

I’m having some trouble running cmake on the OptiX samples. Is this a bug?

PS C:\Users\mquin\Documents\build-optix> cmake "C:\ProgramData\NVIDIA Corporation\OptiX SDK 6.0.0\SDK"
-- Selecting Windows SDK version 10.0.17134.0 to target Windows 10.0.17763.
-- The C compiler identification is MSVC 19.15.26730.0
-- The CXX compiler identification is MSVC 19.15.26730.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.15.26726/bin/Hostx86/x86/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.15.26726/bin/Hostx86/x86/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.15.26726/bin/Hostx86/x86/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.15.26726/bin/Hostx86/x86/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found CUDA: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.2 (found suitable version "9.2", minimum required is "5.0")
CMake Error at CMake/FindOptiX.cmake:82 (message):
  optix library not found.  Please locate before proceeding.
Call Stack (most recent call first):
  CMake/FindOptiX.cmake:91 (OptiX_report_error)
  CMakeLists.txt:206 (find_package)


-- Configuring incomplete, errors occurred!
See also "C:/Users/mquin/Documents/build-optix/CMakeFiles/CMakeOutput.log".
PS C:\Users\mquin\Documents\build-optix> cmake --version
cmake version 3.12.3

CMake suite maintained and supported by Kitware (kitware.com/cmake).
PS C:\Users\mquin\Documents\build-optix>

By changing “C:\ProgramData\NVIDIA Corporation\OptiX SDK 6.0.0\bin64” to “C:\ProgramData\NVIDIA Corporation\OptiX SDK 6.0.0\bin”, I may have gotten it to work. I also changed “lib”, but that might not have been necessary on Windows.

Don’t do that! You seem to have selected the wrong compiler bitness inside CMake.

CMake picks the 32-bit versions by default, but OptiX only supports 64-bit.
Make sure the compiler target you select inside the CMake GUI is named Win64 at the end.

Then the CMake output must not contain x86 tools but amd64 (MSVS 2015) or x64 (MSVS 2017) tools.

For example, it looks like this for MSVS 2015 Professional:
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe – works

and like this for MSVS 2017 Professional:
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.14.26428/bin/Hostx64/x64/cl.exe – works

Thank you. You are correct, my example here was missing the CMake generator:

PS C:\Users\mquin\Documents\build-optix> cmake "C:\ProgramData\NVIDIA Corporation\OptiX SDK 6.0.0\SDK" -G "Visual Studio 15 Win64"