以niohmann-json为例 ,在CMakeLists.txt里加入下面两行即可 find_path(NLOHMANNJSON_INCLUDE_DIR NAMES json.hpp PATH_SUFFIXES nlohmann) include_directories(${NLOHMANNJSON_INCLUDE_DIR})