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!

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,395 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,537 questions
Skype for Business Linux
Skype for Business Linux
Skype for Business: A Microsoft communications service that provides communications capabilities across presence, instant messaging, audio/video calling, and an online meeting experience that includes audio, video, and web conferencing.Linux: A family of open-source Unix-like operating systems.
456 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Minxin Yu 10,031 Reputation points Microsoft Vendor
    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.