Unknown CMake command “ExternalProject_Add”

此生再无相见时 提交于 2019-11-29 09:20:55

The required module should be part of your cmake installation. But you have to include it into your project with:

include(${CMAKE_ROOT}/Modules/ExternalProject.cmake)

before the call of externalproject_add(YOUR STUFF HERE)

Explanation:

CMAKE_ROOT points to the cmake installation in use. All modules are within subfolder Modules.

You can print out the current value with message(STATUS "CMAKE_ROOT=${CMAKE_ROOT}"). Or you are using smart macros for that. See CMake

While it is not directly written in documentation pages, CMake functions described under cmake-modules section requires including specific module.

As function ExternalProject_Add is described in the documentation page titled as "ExternalProject", you need to use

include(ExternalProject)

before using it.


Same strategy works for any other modules except Find<name> ones. Those modules are used via

find_package(<name>)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!