PKG_CONFIG_EXECUTABLE变量由FindPkgConfig.cmake设置的值无效,因此我想检查原因。为此,我增加了variable_watch(PKG_CONFIG_EXECUTABLE)。产出如下:
(...)
CMake Debug Log at /home/my/CMake/share/cmake-3.16/Modules/FindPkgConfig.cmake:27 (if):
Variable "PKG_CONFIG_EXECUTABLE" was accessed using READ_ACCESS with value
"aarc
我正在使用,我试图在文件中使用 for ,因为Cryptopp在其默认的项目存储库中没有CMakeLists.txt文件。我的CMakeLists.txt有以下与密码相关的内容:
# Include usage of external projects
include(FetchContent)
# Get the cryptopp CMakeLists.txt file for cryptopp package
set(CRYPTOPP_CMAKE "cryptopp-cmake")
FetchContent_Declare(
${CRYPTOPP_CMAK
我有一些带有CMakeLists.txt文件的git子模块,这些模块由于CMP0048而导致警告。警告如下所示:
CMake Warning (dev) at submodule_directory/CMakeLists.txt:24 (project):
Policy CMP0048 is not set: project() command manages VERSION variables.
Run "cmake --help-policy CMP0048" for policy details. Use the cmake_policy
command t
如何为CMakeLists.txt编写CMake脚本,使生成器文件中的目标使用生成器命令中提供的额外标志?例如,
命令:
cmake -G“”
制作MY_FLAGS="-Dfoo -Bar“
CMakeLists.txt:
add_executable ( MyApp main.cpp )
# How to reference MY_FLAGS in compile, link commands for MyApp target?
我刚买了我的新相机,英特尔真感D435i。我正在使用mac,所以我想设置SDK来使用我的电脑上的相机。我做了所有的事情,就像文件里说的。我犯了一个错误,它找不到CMakeLists.txt。我上传了那个文件。但当我跑
"cmake .. -DBUILD_EXAMPLES=true -DBUILD_WITH_OPENMP=false -DHWM_OVER_XU=false -G Xcode"
它给了我这个错误
CMake Error at CMakeLists.txt:5 (include):
include could not find requested file:
在执行任何其他操作之前,CMake在执行进程时遇到了问题。
下面的代码片段显示了这种情况:
if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/generated")
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/generated")
execute_process(
# This tool generates library sources, which are not known before
COMMAND "source_file_ge
给定一个大型cmake项目,让B成为位于其中某个目录下的CMakeLists.txt。是否有任何方法从message(...)中打印( B )中的父CMakeLists.txt文件add_subdirectory(B)或等效文件?
注释:,假设没有cmake文件按字面意思执行add_subdirectory(B),而是add_subdirectory(${X}),它是通过cmake树确定的子目录B的路径。否则,这可以仅用grep来确定。
我想让CMake为我制定安装规则,它还会自动安装配置和其他东西。我看了看,但补充道:
add_executable(solshare_stats.conf solshare_stats.conf)
添加到我的CMakeLists.txt文件中只给出了警告和错误:
CMake Error: CMake can not determine linker language for target:solshare_stats.conf
CMake Error: Cannot determine link language for target "solshare_stats.conf"