conan-io / conan-io/docs

Please document visibly the linker failure mode of cmake generator with Visual Studio

Open
#559 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
125
Forks
382
Avg merge
22h 39m
Merged PRs (30d)
21

Description

I mentioned earlier today on the conan Slack channel that I had been having seemingly random build failures when using Conan's `cmake` generator with Visual Studio 2017, and Diego suggested investigating.

It's taken a while, but I now understand the problem I was having, and I've created a small repo to demo it: https://github.com/claremacrae/googletest-starter-project-separate-folders.

To reproduce the problem, you can follow the steps in the readme, https://github.com/claremacrae/googletest-starter-project-separate-folders/tree/6cb2f6dda0c46a6c5f2d2556b10404da429ed591

The error messages are listed in the "Things to note" section at the end of that file..

The crucial thing that causes the linker errors is:

* Either open `build64-release\googletest-starter-project.sln` **in Visual Studio** and do a Debug build
* Or open `build64-debug\googletest-starter-project.sln` **in Visual Studio** and build one of Release, MinSizeRel, or RelWithDebInfo

Now that I understand a bit more about how Conan and CMake work together, and the different generators, I can see that the problem is that CMake and Conan are generating a .sln that only supports a single configuration, but CMake is included all 4 configurations in the .sln, all options to point to the same Google Test build - and inconsistencies occur.

In this case, it's really best not to open one of those .slns in Visual Studio, as the options for confusion and annoyance, especially for novice users are very high.

To save others from this frustration, I think this should be spelled out in something like flashing neon bold letters in every Conan page that talks about using the `cmake` generator for Visual Studio!

----

My configuration:

* Conan: 1.1
* CMake 3.10.2
* Visual Studio Community 2017:

```
Microsoft Visual Studio Community 2017
Version 15.5.6
VisualStudio.15.Release/15.5.6+27130.2027
Microsoft .NET Framework
Version 4.7.02556

Installed Version: Community

...

Visual C++ 2017 00369-60000-00001-AA732
Microsoft Visual C++ 2017
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the linked README reproduction steps and its “Things to note” section, then review the Conan documentation pages that describe the cmake generator for Visual Studio. Document the single-configuration limitation and the resulting linker failure modes prominently, with guidance about opening the generated .sln files; done when users can see and understand this warning before following those instructions.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.