1 # - Define macro to check restrict keyword
3 # GMX_TEST_RESTRICT(VARIABLE)
5 # VARIABLE will be set to the keyword
7 # Remember to have a cmakedefine for it too...
9 MACRO(GMX_TEST_RESTRICT VARIABLE)
10 IF(NOT DEFINED TEST_${VARIABLE})
12 MESSAGE(STATUS "Checking for restrict keyword")
14 # Start with __restrict__, since that is the C++ default keyword.
15 FOREACH(KEYWORD "__restrict__" "__restrict" "restrict")
16 IF(NOT TEST_${VARIABLE})
17 TRY_COMPILE(TEST_${VARIABLE} "${CMAKE_BINARY_DIR}"
18 "${CMAKE_SOURCE_DIR}/cmake/TestRestrict.c"
19 COMPILE_DEFINITIONS "-DTESTRESTRICTDEF=${KEYWORD}" )
20 SET(CHK_RESTRICT_KEYWORD ${KEYWORD})
21 ENDIF(NOT TEST_${VARIABLE})
25 SET(${VARIABLE} ${KEYWORD})
26 MESSAGE(STATUS "Checking for restrict keyword - ${CHK_RESTRICT_KEYWORD}")
27 ELSE(TEST_${VARIABLE})
29 MESSAGE(STATUS "Checking for restrict keyword - not found")
30 ENDIF(TEST_${VARIABLE})
32 ENDIF(NOT DEFINED TEST_${VARIABLE})
33 ENDMACRO(GMX_TEST_RESTRICT VARIABLE)