我正在构建一个以https://github.com/j0r1/JRTPLIB为子目录的项目,因为我需要在构建项目之前先在其中构建一些内容。我添加了一个基于
的依赖项add_subdirectory(../third_party/JRTPLIB jrtplib)
add_library(myRtspClient SHARED ${SOURCES})
add_dependencies(myRtspClient jrtplib-shared)
其中jrtplib-shared
是../third_party/JRTPLIB
CMakeLists
文件中的目标。
正如您所看到的here,生成了一些头文件并放置在一个非常规的地方。我项目中的这个地方是
android/app/.externalNativeBuild/cmake/debug/armeabi-v7a/jrtplib
其中jrtplib
名称来自add_subdirectory(../third_party/JRTPLIB jrtplib)
行
请注意,它还会将文件生成为 android/app/.externalNativeBuild/cmake/debug/x68/jrtplib
我需要将android/app/.externalNativeBuild/cmake/debug/armeabi-v7a/jrtplib
或android/app/.externalNativeBuild/cmake/debug/x86/jrtplib
中生成的头文件包含到我的项目中以完成编译。
我显然尝试include_directories(jrtplib)
,但它没有用,找不到文件。
那么我应该如何包含从子目录生成的头文件?
更新
1 error generated.
FAILED: /android-sdk-linux/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=i686-none-linux-android --gcc-toolchain=/android-sdk-linux/ndk-bundle/toolchains/x86-4.9/prebuilt/linux-x86_64 --sysroot=/android-sdk-linux/ndk-bundle/sysroot -DmyRtspClient_EXPORTS -I/home/project/src/jscam/myRtspClient/myRtspClient/include -I/home/project/src/jscam/myRtspClient/myRtspClient/../third_party/Base64_live555/include -I/home/project/src/jscam/myRtspClient/myRtspClient/../third_party/md5/include -Ijrtplib/src -isystem /android-sdk-linux/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem /android-sdk-linux/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86/include -isystem /android-sdk-linux/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/backward -isystem /android-sdk-linux/ndk-bundle/sysroot/usr/include/i686-linux-android -D__ANDROID_API__=16 -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mstackrealign -Wa,--noexecstack -Wformat -Werror=format-security -O0 -fno-limit-debug-info -fPIC -MD -MT CMakeFiles/myRtspClient.dir/MediaSession.cpp.o -MF CMakeFiles/myRtspClient.dir/MediaSession.cpp.o.d -o CMakeFiles/myRtspClient.dir/MediaSession.cpp.o -c /home/project/src/jscam/myRtspClient/myRtspClient/MediaSession.cpp
In file included from /home/project/src/jscam/myRtspClient/myRtspClient/MediaSession.cpp:17:
/home/project/src/jscam/myRtspClient/myRtspClient/include/myRtpSession.h:19:10: fatal error: 'rtpsession.h' file not found
#include "rtpsession.h"
^~~~~~~~~~~~~~
1 error generated.
ninja: build stopped: subcommand failed.