CMake引入TensorFlow Lite时,后续运行add_subdirectory失败问题
TensorFlow Lite CMake二次配置报错问题
我按照TensorFlow Lite官方CMake构建指南的最小示例,通过add_subdirectory将TensorFlow Lite的CMakeLists.txt引入项目。首次构建完全正常,但修改顶层CMakeLists.txt(比如添加测试或调整目标链接关系)后,再次运行cmake ..会触发如下报错:
-- Setting build type to Release, for debug builds use'-DCMAKE_BUILD_TYPE=Debug'. CMake Warning at build/abseil-cpp/CMakeLists.txt:70 (message): A future Abseil release will default ABSL_PROPAGATE_CXX_STD to ON for CMake 3.8 and up. We recommend enabling this option to ensure your project still builds correctly. -- Standard libraries to link to explicitly: none -- The Fortran compiler identification is GNU 9.4.0 -- Could NOT find CLANG_FORMAT: Found unsuitable version "0.0", but required is exact version "9" (found CLANG_FORMAT_EXECUTABLE-NOTFOUND) -- -- Configured Eigen 3.4.90 -- -- Proceeding with version: 2.0.6.v2.0.6 -- CMAKE_CXX_FLAGS: -std=c++0x -Wall -pedantic -Werror -Wextra -Werror=shadow -faligned-new -Werror=implicit-fallthrough=2 -Wunused-result -Werror=unused-result -Wunused-parameter -Werror=unused-parameter -fsigned-char CMake Error at build/cpuinfo/CMakeLists.txt:262 (ADD_SUBDIRECTORY): ADD_SUBDIRECTORY not given a binary directory but the given source directory "/opt/------/workspace/------/build/clog-source" is not a subdirectory of "/opt/------/workspace/------/build/cpuinfo". When specifying an out-of-tree source a binary directory must be explicitly specified. CMake Error at build/cpuinfo/CMakeLists.txt:265 (SET_PROPERTY): SET_PROPERTY could not find TARGET clog. Perhaps it has not yet been created. -- Configuring incomplete, errors occurred! See also "/opt/------/workspace/------/build/CMakeFiles/CMakeOutput.log". See also "/opt/------/workspace/------/build/CMakeFiles/CMakeError.log".
该问题在多平台均可复现,仅需包含add_subdirectory并链接TensorFlow Lite HelloWorld目标的最小CMakeLists.txt就能触发。我曾尝试为clog的add_subdirectory指定二进制目录,但引发了更多连锁错误。
内容的提问来源于stack exchange,提问作者ColinBroderick
相关产品推荐
相关产品推荐

