1# Add a test for a given source file for each version of OpenCL 2function(add_header_test NAME SOURCE) 3 foreach(VERSION 100 110 120 200 210 220 300) 4 set(TEST_EXE ${NAME}_${VERSION}) 5 # ICD on Windows uses system headers, which aren't strictly ANSI conformant 6 # and trigger warnings 7 if(NOT (NAME STREQUAL cl_icd_h AND MSVC AND CMAKE_C_FLAGS MATCHES "/Za")) 8 add_executable(${TEST_EXE} ${SOURCE}) 9 target_compile_definitions(${TEST_EXE} 10 PUBLIC -DCL_TARGET_OPENCL_VERSION=${VERSION} 11 ) 12 target_include_directories(${TEST_EXE} 13 PUBLIC ${PROJECT_SOURCE_DIR} 14 ) 15 add_test(NAME ${TEST_EXE} COMMAND ${TEST_EXE}) 16 endif() 17 endforeach(VERSION) 18endfunction(add_header_test) 19 20# Tests 21add_header_test(cl_h test_cl.h.c) 22add_header_test(cl_egl_h test_cl_egl.h.c) 23add_header_test(cl_ext_h test_cl_ext.h.c) 24add_header_test(cl_ext_intel_h test_cl_ext_intel.h.c) 25add_header_test(cl_gl_h test_cl_gl.h.c) 26add_header_test(cl_gl_ext_h test_cl_gl_ext.h.c) 27add_header_test(cl_half_h test_cl_half.h.c) 28add_header_test(cl_icd_h test_cl_icd.h.c) 29add_header_test(cl_platform_h test_cl_platform.h.c) 30add_header_test(cl_opencl_h test_opencl.h.c) 31add_header_test(cl_version_h test_cl_version.h.c) 32add_header_test(headers test_headers.c) 33