Hello, I was trying to write a CMake check for i2c-dev.h. This did not work, because "NULL" is used in i2c-dev.h, but NULL is not defined, during the check.
>Run Build Command:/usr/bin/gmake "cmTryCompileExec139053135/fast"
>usr/bin/c++ -DHAS_I2C_MSG -o
>CMakeFiles/cmTryCompileExec139053135.dir/src.cxx.o -c
>In file included from src.cxx:2:0:
>/usr/include/linux/i2c-dev.h: In function ‘__s32
>/i2c_smbus_write_quick(int,__u8)’:
>/usr/include/linux/i2c-dev.h:176:55: error: ‘NULL’ was not declared in this
>/scope
>/usr/include/linux/i2c-dev.h: In function ‘__s32
>/i2c_smbus_write_byte(int,__u8)’:
>/usr/include/linux/i2c-dev.h:191:41: error: ‘NULL’ was not declared in this
>/scope
>gmake[1]: *** [CMakeFiles/cmTryCompileExec139053135.dir/src.cxx.o] Error 1
>Source file was:
>#include </usr/include/linux/i2c-dev.h>
>int main() {
i2c_msg* tmp;
tmp->buf;
return 0;
}
The attached patch replaces NULL with 0x0, but I'm not sure
if this is a good solution.
The problem is, that on OpenSuSE 12.x i2c-dev.h is in the
package i2c-tools-3.1.0, and in ubuntu in the package linux-libc-dev.
Including i2c.h and i2c-dev.h on OpenSuSE result in a compiler error,
but is needed on ubuntu.
regards,
Martin
dont_use_NULL.patch
Description: Binary data
