开发者

cmake visual studio project subset

For a visual studio generator, can cmake be told to generate a solution that will include only a subset of projects? Currently it generates a solution that includes all projects (ie subdirectories with 开发者_开发技巧cmake list files) - which make it really inconvenient when working on subset of projects.


As far as I know you can not explicitly tell cmake to generate a solution file next to your "Project.sln".

Of course, with Visual Studio 2010, the solution file syntax is relatively straightforward and perhaps you could generate it yourself.

An alternative approach and the one I use in my own projects is to distribute your projects over multiple subdirectories and adding additional CMakeLists.txt with a project definition. In that case, Cmake will generate extra solution files in subdirectories.

E.g. consider a project with applications and libraries:

main CMakeLists.txt:

project( Project )
add_subdirectory( libraries )
add_subdirectory( applications )

in libraries:

project( Libs )
add_subdirectory( corelib )
add_subdirectory( utils )

in applications:

project( Apps )
... # The normal stuff

The result will be a Project.sln and in the directories below a Libs.sln and Apps.sln

Added Bonus: You can step into only the libraries directory and can run CMake from there, because it has its own CMakeLists.txt.

Caveat: You will need to set up the various CMakeLists.txt for your libs and apps, such that they can find the libraries.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜