我正在努力理解以下文件:
因此,我尝试了一个简单的cmakelists.txt文件,如:
% cat CMakeLists.txt cmake_minimum_required(VERSION 3.24) project(p) include(FetchContent) FetchContent_Declare( googletest GIT_REPOSITORY https://github.com/google/googletest.git GIT_TAG 703bd9caab50b139428cea1aaff9974ebee5742e # release-1.10.0 FIND_PACKAGE_ARGS NAMES gtest # This will try calling find_package() FetchContent_MakeAvailable(googletest) find_package(GTest) message(${GTest_DIR})
如果我运行它,我得到的是:
$ cmake ..