简体   繁体   English

使用cmake生成Visual Studio sln项目,而不链接到原始CMakeFiles.txt

[英]Use cmake to generate Visual Studio sln project without link to original CMakeFiles.txt

I need to use cmake to generate visual studio sln file, BUT I want to ensure, that this generated *.sln file will not be connected with original CMakeFiles.txt (I want to generate sln file once). 我需要使用cmake生成visual studio sln文件,但我想确保,这个生成的* .sln文件不会与原始的CMakeFiles.txt连接(我想生成一次sln文件)。

I know that this is not typical usage and the connection with source CMakeFiles.txt is in standard usage perfect, but in my case it is not wanted -- I want to distribute these sln files (solution with projects) to some colleagues, who do not have CMake. 我知道这不是典型的用法,并且与源CMakeFiles.txt的连接在标准用法中是完美的,但在我的情况下它不是想要的 - 我想将这些sln文件(带有项目的解决方案)分发给一些同事,没有CMake。

Maybe there is another approach (except cmake), to create few visual studio project without annoying clicking in Visual Studio. 也许还有另一种方法(除了cmake),创建一些Visual Studio项目而不会在Visual Studio中烦人地点击。

Thanks, 谢谢,

Radek 拉德克

I need to use cmake to generate visual studio sln file, BUT I want to ensure, that this generated *.sln file will not be connected with original CMakeFiles.txt 我需要使用cmake生成visual studio sln文件,但我想确保,这个生成的* .sln文件不会与原始CMakeFiles.txt连接

By design CMake will generate solution files that depend on CMake so this part is not really possible with CMake alone. 根据设计,CMake将生成依赖于CMake的解决方案文件,因此仅使用CMake就不可能实现这一部分。

Maybe there is another approach (except cmake), to create few visual studio project without annoying clicking in Visual Studio. 也许还有另一种方法(除了cmake),创建一些Visual Studio项目而不会在Visual Studio中烦人地点击。

There is a way to stop regeneration in the IDE. 有一种方法可以在IDE中停止重新生成。 I use this in many of my projects most likely for the same reason you do. 我在很多项目中使用它很可能是出于同样的原因。 At least with older versions of Visual Studio the regeneration caused dozens of prompts. 至少在较旧版本的Visual Studio中,重新生成会引发数十个提示。 Although I believe Visual Studio 2013 only prompts 1 time now I still enable this. 虽然我相信Visual Studio 2013现在只提示1次,但我仍然启用此功能。 The following code (inserted near the top of my root CMakelists.txt) is what I use to enable the option to suppress IDE regeneration. 下面的代码(插入我的根CMakelists.txt顶部附近)是我用来启用该选项来禁止IDE重新生成的代码。

option (CMAKE_SUPPRESS_REGENERATION "Suppress the cmake macro that causes regeneration of build scripts during build" ON)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM