2022-06-23 07:26:21 +10:00
|
|
|
set(_TEST_RESTRICT_LIST_DIR ${CMAKE_CURRENT_LIST_DIR})
|
|
|
|
|
2017-01-17 19:20:12 +11:00
|
|
|
macro(test_restrict VARIABLE)
|
|
|
|
if (NOT DEFINED TEST_${VARIABLE})
|
|
|
|
message (STATUS "checking for restrict keyword")
|
|
|
|
FOREACH(KEYWORD "restrict" "__restrict" "__restrict__" "_Restrict")
|
|
|
|
IF (NOT TEST_${VARIABLE})
|
|
|
|
TRY_COMPILE(
|
|
|
|
TEST_${VARIABLE}
|
|
|
|
"${CMAKE_BINARY_DIR}/CMakeTmp"
|
2022-06-23 07:26:21 +10:00
|
|
|
SOURCES "${_TEST_RESTRICT_LIST_DIR}/test_restrict.cpp"
|
2017-01-17 19:20:12 +11:00
|
|
|
COMPILE_DEFINITIONS "-DKEYWORD=${KEYWORD}")
|
|
|
|
set(__test_restrict_last ${KEYWORD})
|
|
|
|
ENDIF (NOT TEST_${VARIABLE})
|
|
|
|
endforeach(KEYWORD)
|
|
|
|
|
|
|
|
if (TEST_${VARIABLE})
|
|
|
|
message (STATUS "checking for restrict keyword - ${__test_restrict_last}")
|
|
|
|
set(${VARIABLE} ${__test_restrict_last} CACHE INTERNAL "restrict keyword" FORCE)
|
|
|
|
else (TEST_${VARIABLE})
|
|
|
|
message (STATUS "checking for restrict keyword - not found")
|
|
|
|
endif(TEST_${VARIABLE})
|
|
|
|
endif(NOT DEFINED TEST_${VARIABLE})
|
|
|
|
endmacro(test_restrict)
|