我很困惑,希望得到您的帮助。
我正在交叉编译一个需要的项目ifaddrs.h
,但无论我如何尝试指定文件的位置,它都找不到它。它位于,/usr/include/ifaddrs.h
我使用下面的代码尝试指向它。(当然这是主机系统的文件,但在这种情况下这不重要。我也将文件放在目标系统的包含目录中:/tmp/toolchain/include
没有不同的结果)。并且message
电话确实打印了/usr/include
但是,如果我将文件放入其中,${CMAKE_CURRENT_SOURCE_DIR}/../include
则可以找到。它在那里,我可以看到它——为什么不是 cmake?
FIND_FILE( IFADDRS ifaddrs.h PATH /usr/include )
get_filename_component(if_path ${IFADDRS} PATH)
message( "IFADDRS = " ${if_path} )
include_directories( ${if_path} )
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../include )
将上面的代码更改为:
include_directories( BEFORE SYSTEM /usr/include )
运行make VERBOSE=1
给出了这个:
[ 18%] Building C object CMakeFiles/cpcommon_lib.dir/eui48.c.o
/tmp/toolchain/arm-linux-uclibc/bin/gcc -DPJ_AUTOCONF=1 -DPJ_IS_BIG_ENDIAN=0 -DPJ_IS_LITTLE_ENDIAN=1 -I/home/bp/MySnapCam/projects/Communication/trunk/cpcommon/src/../include -I/home/bp/MySnapCam/projects/Communication/trunk/cpcommon/src/../../pjproject/pjlib-util/include -I/home/bp/MySnapCam/projects/Communication/trunk/cpcommon/src/../../pjproject/pjlib/include -I/home/bp/MySnapCam/projects/Communication/trunk/cpcommon/src/../../pjproject/pjnath/include -I/usr/include/w32api -I/usr/X11R6/include -I/usr/include/X11 -I/usr/pkg/include -I/opt/csw/include -I/opt/include -I/usr/openwin/include -I/home/bp/MySnapCam/projects/Communication/trunk/cpcommon/src/../../cjson -o CMakeFiles/cpcommon_lib.dir/eui48.c.o -c /home/bp/MySnapCam/projects/Communication/trunk/cpcommon/src/eui48.c
In file included from /home/bp/MySnapCam/projects/Communication/trunk/cpcommon/src/eui48.c:26:
/home/bp/MySnapCam/projects/Communication/trunk/cpcommon/src/impl/eui48_unix.c:14:21: ifaddrs.h: No such file or directory
包含路径中没有/usr/include/
。它也不在 flags.make 文件中。