[CMake] AC_C_RESTRICT

Mateusz Loskot mateusz at loskot.net
Fri Jan 4 09:59:23 EST 2013


On 4 January 2013 14:46, Bill Hoffman <bill.hoffman at kitware.com> wrote:
> On 1/4/2013 9:24 AM, Mateusz Loskot wrote:
>>
>> It tests if C compiler supports C99 restrict keyword,
>> perhaps also implementation-specific form, e.g. __restrict, etc.
>>
>> [1]http://en.wikipedia.org/wiki/Restrict
>
> Should be able to do it with a CheckCSourceCompiles:
>
>
> http://www.cmake.org/cmake/help/v2.8.10/cmake.html#module:CheckCSourceCompiles

Yup:

CHECK_C_SOURCE_COMPILES (
  "int test (void *restrict x); int main (void) {return 0;}"
  HAVE_RESTRICT)

Lots of examples available:
https://github.com/pjanouch/aapng/blob/master/CMakeLists.txt
https://bitbucket.org/poulson/clique/src/ca43759adbe4/external/elemental/CMakeLists.txt

Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net


More information about the CMake mailing list