CMake外部项目BUILD_COMMAND失败

时间:2018-12-16 13:06:09

标签: c++ makefile build cmake

我正在尝试建立一个外部cmake项目,该项目将克隆git存储库并使用 make 构建其内容。

cmake_minimum_required(VERSION 3.13)

project(rplidar NONE)

include(ExternalProject)

ExternalProject_Add(RPLidar
    GIT_REPOSITORY      "https://github.com/Slamtec/rplidar_sdk"
    GIT_TAG             "8291e232af614842447a634b6dbd725b81f24713"
    PREFIX              "${PROJECT_BINARY_DIR}/rplidar"
    CONFIGURE_COMMAND   ""
    BUILD_COMMAND       "make -C ${PROJECT_BINARY_DIR}/rplidar/src/RPLidar/sdk"
    INSTALL_COMMAND     ""
)

当我尝试构建它时:

cmake . -B"build" && cmake --build build

我收到以下错误消息:

/bin/sh: make -C /path/to/build/rplidar/src/RPLidar/sdk: No such file or directory
make[2]: *** [CMakeFiles/RPLidar.dir/build.make:111: rplidar/src/RPLidar-stamp/RPLidar-build] Error 127
make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/RPLidar.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

但是,如果我手动运行 make ,效果很好

make -C /path/to/build/rplidar/src/RPLidar/sdk

为什么CMake不注册路径,我该如何解决?

0 个答案:

没有答案