Using CMake to generate Visual Studio C++ project files

前端 未结 8 1373
花落未央
花落未央 2020-12-02 05:48

I am working on an open source C++ project, for code that compiles on Linux and Windows. I use CMake to build the code on Linux. For ease of development setup and political

8条回答
  •  失恋的感觉
    2020-12-02 06:16

    We moved our department's build chain to CMake, and we had a few internal roadbumps since other departments where using our project files and where accustomed to just importing them into their solutions. We also had some complaints about CMake not being fully integrated into the Visual Studio project/solution manager, so files had to be added manually to CMakeLists.txt; this was a major break in the workflow people were used to.

    But in general, it was a quite smooth transition. We're very happy since we don't have to deal with project files anymore.

    The concrete workflow for adding a new file to a project is really simple:

    1. Create the file, make sure it is in the correct place.
    2. Add the file to CMakeLists.txt.
    3. Build.

    CMake 2.6 automatically reruns itself if any CMakeLists.txt files have changed (and (semi-)automatically reloads the solution/projects).

    Remember that if you're doing out-of-source builds, you need to be careful not to create the source file in the build directory (since Visual Studio only knows about the build directory).

提交回复
热议问题