Include a CMakeLists.txt project inside a Visual Studio solution?

Terence Darwen 16 Reputation points
2021-09-03T21:59:11.447+00:00

I have a Visual Studio 2019 solution that currently has eleven different projects in it. These are various C# and C++ projects that run in docker containers.

I currently have an independent project that is a C++ application that runs in a Linux docker container. This project is based on the Microsoft C++ Team blog post here:

https://devblogs.microsoft.com/cppblog/build-c-applications-in-a-linux-docker-container-with-visual-studio/

Instead of a typical Visual Studio project, it uses a CMakeLists.txt file I open in Visual Studio, which then allows me to compile, run and debug my software in the Linux container.

It works great. However, what I'd like to do, is include this project in my aforementioned solution, but I'm not aware of any way to do this.

Unlike a typical Visual Studio project, it seems I can't just add in the CMakeLists.txt, as a project, to my existing solution. Am I missing something???

Maybe there's a different way to create a C++ application that runs in a Linux docker container that uses a typical Visual Studio project file instead of a CMakeLists.txt file??? If so, I'd be fine with doing that, I'm just not aware of any other way to do this even after googling a good bit on the topic.

I'd appreciate any feedback anyone might have on this topic.

Thanks!

Microsoft 365 and Office | Skype for Business | Linux
Developer technologies | C++
Developer technologies | .NET | Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Minxin Yu 13,506 Reputation points Microsoft External Staff
    2021-09-06T03:02:37.39+00:00

    Hi,

    To include a CMakeLists.txt project, you can choose File > Open > Folder to open a folder containing a CMakeLists.txt file or choose File > Open > CMake. Then, navigate to an existing CMakeCache.txt file. For more information,please refer to the article : CMake projects in Visual Studio.

    For Linux-related questions, you can ask in other linux forums such as: https://www.linux.org/forums/.

    Best regards,

    Minxin Yu


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.