Migrating to SYCL
One-stop forum for getting assistance migrating your existing code to SYCL
48 Discussions

Error when using IntelSYCL in cmake and how to fix

KMEXEC
Beginner
2,021 Views

 

 

Here's how the problem occured.

My cmakelist.txt

set(CMAKE_CXX_STANDARD 20)

#dpcpp
set(CMAKE_C_COMPILER icx)
set(CMAKE_CXX_COMPILER icx)
find_package(IntelSYCL REQUIRED)

add_executable(sycl_framework_test
sycl_framework_test.cpp
)
add_sycl_to_target(TARGET sycl_framework_test SOURCES sycl_framework_test.cpp)

target_include_directories(sycl_framework_test PRIVATE
./
${SYCL_INCLUDE_DIR}
)

target_link_libraries(sycl_framework_test PRIVATE
${SYCL_LIBRARY}
)

When I cmake it, error is following
[CMake] -- SYCL_INCLUDE_DIR: E:/DevFramework/Intel/oneAPI/compiler/2025.2/include
1> [CMake] -- SYCL_LIBRARY=E:/DevFramework/Intel/oneAPI/compiler/2025.2/lib/sycl8.lib
1> [CMake] SYCL feature test compile failed!
1> [CMake] compile output is:
1> [CMake] CMake Error at E:/DevFramework/Intel/oneAPI/compiler/2025.2/lib/cmake/IntelSYCL/IntelSYCLConfig.cmake:388 (SYCL_FEATURE_TEST_EXTRACT):
1> [CMake] SYCL_FEATURE_TEST_EXTRACT Function invoked with incorrect arguments for
1> [CMake] function named: SYCL_FEATURE_TEST_EXTRACT
1> [CMake] Call Stack (most recent call first):
1> [CMake] SYCL/CMakeLists.txt:7 (find_package)
1> [CMake] -- Configuring incomplete, errors occurred!

After I checked my dpc++ files, the problem was locked on a file
Intel\oneAPI\compiler\2025.2\lib\cmake\IntelSYCL\IntelSYCLConfig.cmake

in line 388

SYCL_FEATURE_TEST_EXTRACT(${test_output})

 to fix the problem

only need to change this ${test_output} to "${test_output}"

whole cmake instruction is 

SYCL_FEATURE_TEST_EXTRACT("${test_output}")

 

 

SYCL Compiler version: 20250200

0 Kudos
0 Replies
Reply