如何创建CMAKE变量

发布于 2025-01-18 06:35:23 字数 783 浏览 0 评论 0原文

我只是问了一个问题 a>

我自己解决了这个问题。我想要的是在Visual Studio Cmake Project中创建两个项目配置X86-Linux和X64-Linux。

我有WSL和远程Linux。

请参阅,在链接中,我有一个变量force_32。如果将其设置为1,我希望CMAKE将继续构建正确的二进制文件。但是问题是如何通过“管理配置”或“ cmakesettings.json”设置此变量。我

 "variables": [
        {
          "name": "FORCE_32",
          "value": "1",
          "type": "INTEGER"
        }
      ]

在cmakesettings.json中尝试过,并在视觉工作室中得到了此警告,

manually-specified variables were not used by the project visual studio FORCE_32

Linux -x64

我不知道该如何进行。我要做的就是一种方法,以便可以随时构建32或64位的构建,而无需每次编辑CMakelists.txt

I just asked a question here

That problem is solved by myself. All i want is to create two project configurations x86-Linux and x64-Linux in Visual studio CMake Project.

I have both WSL and remote linux.

See, in the link, i have a variable FORCE_32. If it is set to 1, i hope cmake will proceed to build the correct binaries. But the problem is how to set this variable via "Manage Configurations" or "CMakeSettings.json". I tried

 "variables": [
        {
          "name": "FORCE_32",
          "value": "1",
          "type": "INTEGER"
        }
      ]

in CMakeSettings.json and to which i got this warning in Visual Studio

manually-specified variables were not used by the project visual studio FORCE_32

Linux -x64

I do not know how to proceed. All i am trying to do is a way so that 32 or 64 bit builds can be built any time without editing CMakeLists.txt each time

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

書生途 2025-01-25 06:35:23

在cmakesettings.json修改中

"cmakeCommandArgs": "-DFORCE_32:INTEGER=1",

In CMakeSettings.json modify

"cmakeCommandArgs": "-DFORCE_32:INTEGER=1",
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文