OneAPI support with Custom Toolchain

I’m trying to write a custom toolchain file to support compiling a simple OneAPI project with the DPCPP compiler. It was suggested in a recent workshop that I write a custom toolchain file, which I have done (see attached). However, I’m failing on the configure step currently. Am I missing something simple about how to include and test dpcpp as the default CXX_COMPILER?

cmake -B oneapi_build -S . -DCMAKE_TOOLCHAIN_FILE=cmake/oneapi-toolchain.cmake
-- Using DPCPP toolchain in /net/tools/intel/oneapi/beta07/inteloneapi
-- Using DPCPP toolchain in /net/tools/intel/oneapi/beta07/inteloneapi
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is Clang 11.0.0
System is unknown to cmake, create:
Platform/OneAPI to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Detecting C compiler ABI info
System is unknown to cmake, create:
Platform/OneAPI to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
System is unknown to cmake, create:
Platform/OneAPI to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /net/tools/intel/oneapi/beta07/inteloneapi/compiler/latest/linux/bin/dpcpp - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /localscratch/jyoung9/sycl-testing/oneapi_build ./run_cmake_build.sh
-- Using DPCPP toolchain in /net/tools/intel/oneapi/beta07/inteloneapi
-- Using DPCPP toolchain in /net/tools/intel/oneapi/beta07/inteloneapi
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is Clang 11.0.0
System is unknown to cmake, create:
Platform/OneAPI to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Detecting C compiler ABI info
System is unknown to cmake, create:
Platform/OneAPI to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
System is unknown to cmake, create:
Platform/OneAPI to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /net/tools/intel/oneapi/beta07/inteloneapi/compiler/latest/linux/bin/dpcpp - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /localscratch/sycl-testing/oneapi_build
# cmake/oneapi-toolchain.cmake
set(CMAKE_SYSTEM_NAME OneAPI)

#Usually ONEAPI_ROOT will be set by a call to setvars.sh
if(DEFINED ENV{ONEAPI_ROOT})
	set(ONEAPI_BASE $ENV{ONEAPI_ROOT})
else()
	set(ONEAPI_BASE "/opt/intel/inteloneapi")
endif()

message(STATUS "Using DPCPP toolchain in ${ONEAPI_BASE}")
set(CMAKE_CXX_COMPILER "${ONEAPI_BASE}/compiler/latest/linux/bin/dpcpp")

I realized that I had learned the wrong lesson from a different toolchain example cross-compiling for a different platform. Changing the system name to Linux fixes this problem, although it still skips checking that dpcpp compiles a test program.

# cmake/oneapi-toolchain.cmake (updated)
set(CMAKE_SYSTEM_NAME Linux)