cmake 相关问题

CMake是一个跨平台的开源构建系统生成器。它为构建系统生成文件,如本机makefile,ninja-build和几个集成开发环境的项目文件。

无法在Windows上运行使用Graphviz库编译的.exe文件

说明: 我想在我的 Cpp 项目中使用 Graphviz 库 gvc。 Cpp项目是一个极其简化的语法分析器,我包含了graphviz/gvc.h来绘制语法分析树。 我...

回答 1 投票 0

QT C++ 文件夹结构 - ui.h 的 CMake 问题

请注意,有一些与我的问题相同的相关问题,但我无法看到我的具体错误,也无法找到解决方案。所以我请求社区

回答 1 投票 0

尝试使用 CMake 构建时,PkgConfig 找不到“glib-2.0”

我正在尝试使用 CMake 编译一个用 C++ 编写的程序。 代码附带的 CMakeLists.txt 文件的内容是: cmake_minimum_required(版本3.21) 项目( 我正在尝试使用 CMake 编译一个用 C++ 编写的程序。 代码附带的 CMakeLists.txt 文件的内容是: cmake_minimum_required(VERSION 3.21) project(<redacted> C CXX) set(CMAKE_CXX_STANDARD 23) add_executable(<redacted> src/main.cpp src/<redacted>.h src/<redacted>.h src/<redacted>.cpp src/<redacted>.h src/<redacted>.h src/<redacted>.cpp src/<redacted>.h src/<redacted>.cpp src/<redacted>.h src/<redacted>.h src/<redacted>.c src/<redacted>.h) find_package(PkgConfig REQUIRED) pkg_search_module(GLIB REQUIRED glib-2.0) include_directories(${GLIB_INCLUDE_DIRS}) link_directories(${GLIB_LIBRARY_DIRS}) target_link_libraries(<redacted> ${GLIB_LIBRARIES} gcrypt) 当我在 w64devkit(或 Visual Studio 或 VSCode)中运行命令:cmake . -G "MinGW Makefiles" && make时,出现以下错误: -- Found PkgConfig: C:/Users/Jonathon/Downloads/pkg-config-lite-0.28-1_bin-win32/pkg-config-lite-0.28-1/bin/pkg-config.exe (found version "0.28") -- Checking for module 'glib-2.0' -- No package 'glib-2.0' found CMake Error at C:/Program Files/CMake/share/cmake-3.29/Modules/FindPkgConfig.cmake:634 (message): The following required packages were not found: - glib-2.0 Call Stack (most recent call first): C:/Program Files/CMake/share/cmake-3.29/Modules/FindPkgConfig.cmake:862 (_pkg_check_modules_internal) CMakeLists.txt:28 (PKG_CHECK_MODULES) -- Configuring incomplete, errors occurred! 有一个类似的帖子here,但那是在Linux上,而我在Windows上。另外,找到的解决方案是从 CMakeLists.txt 中删除一行,但该行不存在于我的 CMakeLists.txt 文件中。 任何帮助将不胜感激。谢谢 [更新] 我尝试使用 conan 安装 glib,并将其用作 conanfile.txt: [requires] glib/2.78.3 [generators] CMakeDeps CMakeToolchain 然后,当我输入命令 conan install . --output-folder=build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake && cmake --build (按照建议 here 因为我在使用 conan install . --output-folder=build && cmake --build 时收到“错误:找不到 Conanfile”),这是我得到的输出: ======== Input profiles ======== Profile host: [settings] arch=x86_64 build_type=Release compiler=msvc compiler.cppstd=14 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=193 os=Windows Profile build: [settings] arch=x86_64 build_type=Release compiler=msvc compiler.cppstd=14 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=193 os=Windows ======== Computing dependency graph ======== Graph root conanfile.txt: C:\Users\Jonathon\source\tlsdump-main\tlsdump-main\conanfile.txt Requirements bzip2/1.0.8#457c272f7da34cb9c67456dd217d36c4 - Cache glib/2.78.3#0cd1865c8603d90b3bc5858065e16d01 - Cache libffi/3.4.4#35eb63842b505824b70aedc1baefc916 - Cache libgettext/0.22#2c87563d7a69544dd9379f038aca3b0b - Cache libiconv/1.17#73fefc1b696e069df90fd1d18aa63edd - Cache pcre2/10.42#a7a2c122056510509a7525c83d6a6695 - Cache zlib/1.3.1#f52e03ae3d251dec704634230cd806a2 - Cache Build requirements autoconf/2.71#f9307992909d7fb3df459340f1932809 - Cache automake/1.16.5#058bda3e21c36c9aa8425daf3c1faf50 - Cache m4/1.4.19#b38ced39a01e31fef5435bc634461fd2 - Cache meson/1.2.2#04bdfb85d665c82b08a3510aee3ffd19 - Cache msys2/cci.latest#5a31efa2bde593541fd5ac3bcc50c01c - Cache ninja/1.11.1#77587f8c8318662ac8e5a7867eb4be21 - Cache pkgconf/2.0.3#f996677e96e61e6552d85e83756c328b - Cache Resolved version ranges zlib/[>=1.2.11 <2]: zlib/1.3.1 ======== Computing necessary packages ======== Requirements bzip2/1.0.8#457c272f7da34cb9c67456dd217d36c4:67bfcb7b4b78262b9d05495e479dcd92f747316b#cea9c0f0dfa41e83aebd5d39c5a5cbf3 - Cache glib/2.78.3#0cd1865c8603d90b3bc5858065e16d01:750e9c8cf560085c96c0fa42531c45c18af8be50#29d02404508c39a0803c3bee40426924 - Cache libffi/3.4.4#35eb63842b505824b70aedc1baefc916:7bfde258ff4f62f75668d0896dbddedaa7480a0f#37e6c892e9418389fcf21227e9c1ae6b - Cache libgettext/0.22#2c87563d7a69544dd9379f038aca3b0b:55052839d1d508208c0cd4c7594a7001c70287d1#bea6a5629dc31a80b4d489e5ef163ec4 - Cache libiconv/1.17#73fefc1b696e069df90fd1d18aa63edd:7bfde258ff4f62f75668d0896dbddedaa7480a0f#9ef92719f5c05dca2f0dbb46f50d3f8d - Cache pcre2/10.42#a7a2c122056510509a7525c83d6a6695:1bbffc30d8479a890917ef6674ab5e5f3c5b2036#d6a7c0162d1450645a9d56832ca25ae6 - Cache zlib/1.3.1#f52e03ae3d251dec704634230cd806a2:7bfde258ff4f62f75668d0896dbddedaa7480a0f#20d10b761ec15eed7a1d61c86bc7415a - Cache Build requirements Skipped binaries autoconf/2.71, automake/1.16.5, m4/1.4.19, meson/1.2.2, msys2/cci.latest, ninja/1.11.1, pkgconf/2.0.3 ======== Installing packages ======== bzip2/1.0.8: Already installed! (1 of 7) zlib/1.3.1: Already installed! (2 of 7) libiconv/1.17: Already installed! (3 of 7) libffi/3.4.4: Already installed! (4 of 7) pcre2/10.42: Already installed! (5 of 7) pcre2/10.42: Appending PATH environment variable: C:\Users\Jonathon\.conan2\p\pcre2e09694aa47719\p\bin libgettext/0.22: Already installed! (6 of 7) glib/2.78.3: Already installed! (7 of 7) WARN: deprecated: Usage of deprecated Conan 1.X features that will be removed in Conan 2.X: WARN: deprecated: 'cpp_info.names' used in: zlib/1.3.1, bzip2/1.0.8, pcre2/10.42, libiconv/1.17, libgettext/0.22 WARN: deprecated: 'cpp_info.build_modules' used in: bzip2/1.0.8 WARN: deprecated: 'env_info' used in: pcre2/10.42, libiconv/1.17, bzip2/1.0.8, glib/2.78.3 ======== Finalizing install (deploy, generators) ======== conanfile.txt: Writing generators to C:\Users\Jonathon\source\tlsdump-main\tlsdump-main\build conanfile.txt: Generator 'CMakeDeps' calling 'generate()' conanfile.txt: CMakeDeps necessary find_package() and targets for your CMakeLists.txt find_package(glib) target_link_libraries(... glib::glib) conanfile.txt: Generator 'CMakeToolchain' calling 'generate()' conanfile.txt: CMakeToolchain generated: conan_toolchain.cmake conanfile.txt: Preset 'conan-default' added to CMakePresets.json. Invoke it manually using 'cmake --preset conan-default' if using CMake>=3.23 conanfile.txt: If your CMake version is not compatible with CMakePresets (<3.23) call cmake like: 'cmake <path> -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE=C:\Users\Jonathon\source\tlsdump-main\tlsdump-main\build\conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW' conanfile.txt: CMakeToolchain generated: CMakePresets.json conanfile.txt: CMakeToolchain generated: ..\CMakeUserPresets.json conanfile.txt: Generating aggregated env files conanfile.txt: Generated aggregated env files: ['conanbuild.bat', 'conanrun.bat'] Install finished successfully -- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045. -- Checking for one of the modules 'glib-2.0' CMake Error at C:/Program Files/CMake/share/cmake-3.29/Modules/FindPkgConfig.cmake:927 (message): None of the required 'glib-2.0' found Call Stack (most recent call first): CMakeLists.txt:20 (pkg_search_module) -- Configuring incomplete, errors occurred! 现在,glib 版本 2.78.3 已安装,因为这是 conan 提供的最新版本。 conan 提供的最早版本是 2.65.0,因此当我尝试更改 conanfile 以尝试获取版本 2.0.0 时,它不起作用。另外,版本 2.0.0 是 2002 年的版本,我非常怀疑我正在尝试编译的项目正在使用它,因为它是去年制作的。 当我返回 CMakeLists.txt 文件并更改此行时: pkg_search_module(GLIB REQUIRED glib-2.0) 到 pkg_search_module(GLIB REQUIRED glib-2.78.3),然后再次运行 conan install . --output-folder=build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake && cmake --build 命令,我得到以下输出:======== Input profiles ======== Profile host: [settings] arch=x86_64 build_type=Release compiler=msvc compiler.cppstd=14 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=193 os=Windows Profile build: [settings] arch=x86_64 build_type=Release compiler=msvc compiler.cppstd=14 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=193 os=Windows ======== Computing dependency graph ======== Graph root conanfile.txt: C:\Users\Jonathon\source\tlsdump-main\tlsdump-main\conanfile.txt Requirements bzip2/1.0.8#457c272f7da34cb9c67456dd217d36c4 - Cache glib/2.78.3#0cd1865c8603d90b3bc5858065e16d01 - Cache libffi/3.4.4#35eb63842b505824b70aedc1baefc916 - Cache libgettext/0.22#2c87563d7a69544dd9379f038aca3b0b - Cache libiconv/1.17#73fefc1b696e069df90fd1d18aa63edd - Cache pcre2/10.42#a7a2c122056510509a7525c83d6a6695 - Cache zlib/1.3.1#f52e03ae3d251dec704634230cd806a2 - Cache Build requirements autoconf/2.71#f9307992909d7fb3df459340f1932809 - Cache automake/1.16.5#058bda3e21c36c9aa8425daf3c1faf50 - Cache m4/1.4.19#b38ced39a01e31fef5435bc634461fd2 - Cache meson/1.2.2#04bdfb85d665c82b08a3510aee3ffd19 - Cache msys2/cci.latest#5a31efa2bde593541fd5ac3bcc50c01c - Cache ninja/1.11.1#77587f8c8318662ac8e5a7867eb4be21 - Cache pkgconf/2.0.3#f996677e96e61e6552d85e83756c328b - Cache Resolved version ranges zlib/[>=1.2.11 <2]: zlib/1.3.1 ======== Computing necessary packages ======== Requirements bzip2/1.0.8#457c272f7da34cb9c67456dd217d36c4:67bfcb7b4b78262b9d05495e479dcd92f747316b#cea9c0f0dfa41e83aebd5d39c5a5cbf3 - Cache glib/2.78.3#0cd1865c8603d90b3bc5858065e16d01:750e9c8cf560085c96c0fa42531c45c18af8be50#29d02404508c39a0803c3bee40426924 - Cache libffi/3.4.4#35eb63842b505824b70aedc1baefc916:7bfde258ff4f62f75668d0896dbddedaa7480a0f#37e6c892e9418389fcf21227e9c1ae6b - Cache libgettext/0.22#2c87563d7a69544dd9379f038aca3b0b:55052839d1d508208c0cd4c7594a7001c70287d1#bea6a5629dc31a80b4d489e5ef163ec4 - Cache libiconv/1.17#73fefc1b696e069df90fd1d18aa63edd:7bfde258ff4f62f75668d0896dbddedaa7480a0f#9ef92719f5c05dca2f0dbb46f50d3f8d - Cache pcre2/10.42#a7a2c122056510509a7525c83d6a6695:1bbffc30d8479a890917ef6674ab5e5f3c5b2036#d6a7c0162d1450645a9d56832ca25ae6 - Cache zlib/1.3.1#f52e03ae3d251dec704634230cd806a2:7bfde258ff4f62f75668d0896dbddedaa7480a0f#20d10b761ec15eed7a1d61c86bc7415a - Cache Build requirements Skipped binaries autoconf/2.71, automake/1.16.5, m4/1.4.19, meson/1.2.2, msys2/cci.latest, ninja/1.11.1, pkgconf/2.0.3 ======== Installing packages ======== bzip2/1.0.8: Already installed! (1 of 7) zlib/1.3.1: Already installed! (2 of 7) libiconv/1.17: Already installed! (3 of 7) libffi/3.4.4: Already installed! (4 of 7) pcre2/10.42: Already installed! (5 of 7) pcre2/10.42: Appending PATH environment variable: C:\Users\Jonathon\.conan2\p\pcre2e09694aa47719\p\bin libgettext/0.22: Already installed! (6 of 7) glib/2.78.3: Already installed! (7 of 7) WARN: deprecated: Usage of deprecated Conan 1.X features that will be removed in Conan 2.X: WARN: deprecated: 'cpp_info.names' used in: bzip2/1.0.8, libiconv/1.17, libgettext/0.22, zlib/1.3.1, pcre2/10.42 WARN: deprecated: 'cpp_info.build_modules' used in: bzip2/1.0.8 WARN: deprecated: 'env_info' used in: glib/2.78.3, bzip2/1.0.8, libiconv/1.17, pcre2/10.42 ======== Finalizing install (deploy, generators) ======== conanfile.txt: Writing generators to C:\Users\Jonathon\source\tlsdump-main\tlsdump-main\build conanfile.txt: Generator 'CMakeDeps' calling 'generate()' conanfile.txt: CMakeDeps necessary find_package() and targets for your CMakeLists.txt find_package(glib) target_link_libraries(... glib::glib) conanfile.txt: Generator 'CMakeToolchain' calling 'generate()' conanfile.txt: CMakeToolchain generated: conan_toolchain.cmake conanfile.txt: Preset 'conan-default' added to CMakePresets.json. Invoke it manually using 'cmake --preset conan-default' if using CMake>=3.23 conanfile.txt: If your CMake version is not compatible with CMakePresets (<3.23) call cmake like: 'cmake <path> -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE=C:\Users\Jonathon\source\tlsdump-main\tlsdump-main\build\conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW' conanfile.txt: CMakeToolchain generated: CMakePresets.json conanfile.txt: CMakeToolchain generated: ..\CMakeUserPresets.json conanfile.txt: Generating aggregated env files conanfile.txt: Generated aggregated env files: ['conanbuild.bat', 'conanrun.bat'] Install finished successfully -- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045. -- Checking for one of the modules 'glib-2.0' CMake Error at C:/Program Files/CMake/share/cmake-3.29/Modules/FindPkgConfig.cmake:927 (message): None of the required 'glib-2.0' found Call Stack (most recent call first): CMakeLists.txt:20 (pkg_search_module) -- Configuring incomplete, errors occurred! C:\Users\Jonathon\source\tlsdump-main\tlsdump-main\build>cd .. C:\Users\Jonathon\source\tlsdump-main\tlsdump-main>conan install . --output-folder=build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake && cmake --build ======== Input profiles ======== Profile host: [settings] arch=x86_64 build_type=Release compiler=msvc compiler.cppstd=14 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=193 os=Windows Profile build: [settings] arch=x86_64 build_type=Release compiler=msvc compiler.cppstd=14 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=193 os=Windows ======== Computing dependency graph ======== Graph root conanfile.txt: C:\Users\Jonathon\source\tlsdump-main\tlsdump-main\conanfile.txt Requirements bzip2/1.0.8#457c272f7da34cb9c67456dd217d36c4 - Cache glib/2.78.3#0cd1865c8603d90b3bc5858065e16d01 - Cache libffi/3.4.4#35eb63842b505824b70aedc1baefc916 - Cache libgettext/0.22#2c87563d7a69544dd9379f038aca3b0b - Cache libiconv/1.17#73fefc1b696e069df90fd1d18aa63edd - Cache pcre2/10.42#a7a2c122056510509a7525c83d6a6695 - Cache zlib/1.3.1#f52e03ae3d251dec704634230cd806a2 - Cache Build requirements autoconf/2.71#f9307992909d7fb3df459340f1932809 - Cache automake/1.16.5#058bda3e21c36c9aa8425daf3c1faf50 - Cache m4/1.4.19#b38ced39a01e31fef5435bc634461fd2 - Cache meson/1.2.2#04bdfb85d665c82b08a3510aee3ffd19 - Cache msys2/cci.latest#5a31efa2bde593541fd5ac3bcc50c01c - Cache ninja/1.11.1#77587f8c8318662ac8e5a7867eb4be21 - Cache pkgconf/2.0.3#f996677e96e61e6552d85e83756c328b - Cache Resolved version ranges zlib/[>=1.2.11 <2]: zlib/1.3.1 ======== Computing necessary packages ======== Requirements bzip2/1.0.8#457c272f7da34cb9c67456dd217d36c4:67bfcb7b4b78262b9d05495e479dcd92f747316b#cea9c0f0dfa41e83aebd5d39c5a5cbf3 - Cache glib/2.78.3#0cd1865c8603d90b3bc5858065e16d01:750e9c8cf560085c96c0fa42531c45c18af8be50#29d02404508c39a0803c3bee40426924 - Cache libffi/3.4.4#35eb63842b505824b70aedc1baefc916:7bfde258ff4f62f75668d0896dbddedaa7480a0f#37e6c892e9418389fcf21227e9c1ae6b - Cache libgettext/0.22#2c87563d7a69544dd9379f038aca3b0b:55052839d1d508208c0cd4c7594a7001c70287d1#bea6a5629dc31a80b4d489e5ef163ec4 - Cache libiconv/1.17#73fefc1b696e069df90fd1d18aa63edd:7bfde258ff4f62f75668d0896dbddedaa7480a0f#9ef92719f5c05dca2f0dbb46f50d3f8d - Cache pcre2/10.42#a7a2c122056510509a7525c83d6a6695:1bbffc30d8479a890917ef6674ab5e5f3c5b2036#d6a7c0162d1450645a9d56832ca25ae6 - Cache zlib/1.3.1#f52e03ae3d251dec704634230cd806a2:7bfde258ff4f62f75668d0896dbddedaa7480a0f#20d10b761ec15eed7a1d61c86bc7415a - Cache Build requirements Skipped binaries autoconf/2.71, automake/1.16.5, m4/1.4.19, meson/1.2.2, msys2/cci.latest, ninja/1.11.1, pkgconf/2.0.3 ======== Installing packages ======== bzip2/1.0.8: Already installed! (1 of 7) zlib/1.3.1: Already installed! (2 of 7) libiconv/1.17: Already installed! (3 of 7) libffi/3.4.4: Already installed! (4 of 7) pcre2/10.42: Already installed! (5 of 7) pcre2/10.42: Appending PATH environment variable: C:\Users\Jonathon\.conan2\p\pcre2e09694aa47719\p\bin libgettext/0.22: Already installed! (6 of 7) glib/2.78.3: Already installed! (7 of 7) WARN: deprecated: Usage of deprecated Conan 1.X features that will be removed in Conan 2.X: WARN: deprecated: 'cpp_info.names' used in: pcre2/10.42, libiconv/1.17, bzip2/1.0.8, zlib/1.3.1, libgettext/0.22 WARN: deprecated: 'cpp_info.build_modules' used in: bzip2/1.0.8 WARN: deprecated: 'env_info' used in: pcre2/10.42, bzip2/1.0.8, glib/2.78.3, libiconv/1.17 ======== Finalizing install (deploy, generators) ======== conanfile.txt: Writing generators to C:\Users\Jonathon\source\tlsdump-main\tlsdump-main\build conanfile.txt: Generator 'CMakeDeps' calling 'generate()' conanfile.txt: CMakeDeps necessary find_package() and targets for your CMakeLists.txt find_package(glib) target_link_libraries(... glib::glib) conanfile.txt: Generator 'CMakeToolchain' calling 'generate()' conanfile.txt: CMakeToolchain generated: conan_toolchain.cmake conanfile.txt: Preset 'conan-default' added to CMakePresets.json. Invoke it manually using 'cmake --preset conan-default' if using CMake>=3.23 conanfile.txt: If your CMake version is not compatible with CMakePresets (<3.23) call cmake like: 'cmake <path> -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE=C:\Users\Jonathon\source\tlsdump-main\tlsdump-main\build\conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW' conanfile.txt: CMakeToolchain generated: CMakePresets.json conanfile.txt: CMakeToolchain generated: ..\CMakeUserPresets.json conanfile.txt: Generating aggregated env files conanfile.txt: Generated aggregated env files: ['conanbuild.bat', 'conanrun.bat'] Install finished successfully -- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045. -- Checking for one of the modules 'glib-2.78.3' CMake Error at C:/Program Files/CMake/share/cmake-3.29/Modules/FindPkgConfig.cmake:927 (message): None of the required 'glib-2.78.3' found Call Stack (most recent call first): CMakeLists.txt:20 (pkg_search_module) -- Configuring incomplete, errors occurred! 这对我来说真的没有意义,因为当它安装软件包时,它清楚地以亮绿色显示这一行:glib/2.78.3: Already installed! (7 of 7),然后不久之后,它仍然显示:-- Checking for one of the modules 'glib-2.78.3' CMake Error at C:/Program Files/CMake/share/cmake-3.29/Modules/FindPkgConfig.cmake:927 (message): None of the required 'glib-2.78.3' found 所以我真的不知道发生了什么。 glib 显然已安装,但由于某种原因 cmake pkgconfig 仍然找不到它。我做错了什么? 总结我在评论中的解释: 应该可以设置 PKG_CONFIG_PATH 环境变量以将其指向 glib 安装。 pkg-config 在此变量(以及其他一些变量)指定的目录中查找库。但是我宁愿推荐使用MSYS2,而不是进行手动配置。用它来安装您需要的所有工具:pacman -S mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-pkgconf mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-glib2。打开 MSYS2 终端并在其中进行编译(以设置正确的环境变量)。验证终端提示是否以洋红色文本显示 UCRT64(什么是 MSYS2 环境?如何选择一个?)。 您可以尝试pkg-config --libs --cflags glib-2.0并看到它找到该库。

回答 1 投票 0

如何设置 CMake 为 iPhone 构建库

我正在尝试使用 CMake 通过手动设置某些属性来为 iPhone 生成 Xcode 配置。 (这是否是解决此问题的正确方法?)我的 CMake 文件如下所示: 项目(M...

回答 3 投票 0

如果存在超链接,如何翻译Sphinx的'parsed-literal'指令的内容?

问题描述 最近,我尝试使用 gettext 生成器生成的 gettext .po 文件来构建 CMake 文档。但是,我想知道如何翻译 parsed-lite 的内容...

回答 1 投票 0

如何构建 CMake 库并使用命名空间包含其头文件?

我有一个 CMake 项目,其文件夹结构如下: 我的仓库在这里 ├── CMakeLists.txt ├── conanfile.py ├── 包括 │   └── my_algorithm.h ├── 来源 │   └── my_algorithm.cpp └── 测试包 ├──

回答 1 投票 0

将 libXi 与 Vcpkg 结合使用

我正在尝试创建一个C项目,以libXi作为依赖项来控制鼠标在Linux系统上的移动(不仅仅是在1个窗口中)。我正在尝试使用 Vcpkg 并按照以下教程进行操作...

回答 1 投票 0

如何在工具链文件中使用try_compile

是否可以在工具链文件中使用try_compile?我的 toolchain.cmake 中有以下代码: 设置(MAIN_SOURCE“int main(){}”) 尝试编译( 编译结果

回答 1 投票 0

使用生成的父文件(lzz、vscode)进行 C++ 调试

我正在使用 lzz 从项目中的仅标头文件生成 .hpp 和 .cpp 文件。 (我们称它们为 .hpp_dev) CMake 用于将生成的文件构建到库中,然后链接到

回答 1 投票 0

在 Clion 中集成 Emscripten

我最近正在做一个项目,其中包括 Emscripten 的使用。我可以在终端上安装并运行一些示例,但我想将其与 Clion 集成,以便我可以直接包含

回答 5 投票 0

sycl CUDA 后端的 Cmake 文件

我在编写 CMake 文件以将 SYCL 代码卸载到 NVIDIA 后端时遇到问题。我的 CMake 文件目前看起来像这样 cmake_minimum_required(版本3.22.1) 设置(CMAKE_C_COMPILER /opt/intel/o...

回答 3 投票 0

链接到 libssh 时对 ARM 进行交叉编译:无法识别文件

我正在尝试使用ARM架构交叉编译libssh库,以便我可以交叉编译另一个需要libssh的库(netconf2)。这样我就可以交叉编译我在

回答 1 投票 0

如何正确使用cmake链接库?

我无法获取正在使用的其他库来正确链接到我的项目。 我正在使用 CLion,它使用 cmake 来构建其项目。我正在尝试结合使用多个库...

回答 1 投票 0

Steinberg 的 VST3 插件生成器需要什么目录?

我正在尝试使用与 Steinberg VST3 SDK 捆绑在一起的 VST 项目生成器制作一个新插件。它需要 SDK 的路径,但它拒绝该路径并显示消息“The se...

回答 1 投票 0

我应该使用哪个选项来设置 CMake 中的编译器选项?

我注意到似乎有两种方法可以在 CMake 文件中设置编译器选项: target_compile_options(${TargetName} PRIVATE "-O3") 或者 设置(CMAKE_CXX_FLAGS“${CMAKE_CXX_FLAGS} -O3&qu...

回答 1 投票 0

如何在CMake中链接lz4库?

我尝试使用此 cmake 命令在 Ubuntu 22.04 上的 Clion 中配置我的 C++ 项目 find_package(lz4需要配置) include_directories(${LZ4_INCLUDE_DIRS}) target_link_libraries(${PROJECT_N...

回答 1 投票 0

在cmake中检测项目语言

我想检测当前的项目语言,例如,如果我有这样的东西: cmake_minimum_required(版本3.0) 项目(foo 版本 1.0 语言 CXX) 我需要这样的东西...

回答 2 投票 0

如何在 CMake 中的项目之间使用“add_dependency”

我尝试构建项目“abc”。为了构建它,我还需要“xyz_made.cpp”,它是从另一个项目“xyz”(自动)生成的源文件。 如果“xyz”有...

回答 1 投票 0

如何使用 CMake、MacOS 链接共享库

我构建了一个名为 foo_shared_debug.dylib 的共享库。我想将它链接到一个我称为 bar 的可执行文件。 我能够构建栏,但在运行时我得到了一个 dyld[xxxx]:库未加载:

回答 1 投票 0

根据工具链文件中的定义替换单个函数定义

我正在制作一个库,它将定义许多函数。每个函数都会有一个默认版本,然后用户可以提供一个包含每个函数的替代定义的文件...

回答 2 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.