conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
8.23k stars 980 forks source link

[bug] Static Runtime ignored on Visual Studio #10888

Open Sil3ntStorm opened 2 years ago

Sil3ntStorm commented 2 years ago

Environment Details (include every applicable attribute)

Steps to reproduce (Include if Applicable)

Similar to #10299 the runtime definition of "MT" / "MTd" is ignored and the Visual Studio project generated by cmake sets the Runtime to "MD" / "MDd" when built using the following conan profile:

[settings]
arch=x86_64
arch_build=x86_64
build_type=Debug
compiler=Visual Studio
compiler.cppstd=17
compiler.runtime=MTd
compiler.version=16
os=Windows
os_build=Windows
[options]
[build_requires]
[env]

This will ultimately cause the build to happen with the wrong runtime, which causes linker errors when consuming the recipe.

memsharded commented 2 years ago

That depends on the build system integration used, knowing the profile is not enough. You would need to provide a minimum example (recommended conan new with modern templates --template=cmake_lib if possible) to reproduce it.

Sil3ntStorm commented 2 years ago

The recipe is a copy of https://conan.io/center/json-schema-validator?tab=configuration which has been modified to pull from the latest sources and work around a few issues in both the json-validator project as well as this bug. The recipe uses the old from conans import ConanFile, CMake, tools cmake stuff.

memsharded commented 2 years ago

But that could be something specific of the json-schema-validator build system (and thus, need to move it to ConanCenter repo, to fix the recipe). Can you reproduce it with a simple, hello world example (like with conan new hello/0.1 -s, if you want to test it with the legacy integrations)?

Sil3ntStorm commented 2 years ago

That would require me to actually have something to build as a library and a CMake setup for it, and I don't deal in cmake. So unfortunately I won't be able to provide such in the foreseeable future.

memsharded commented 2 years ago

That would require me to actually have something to build as a library and a CMake setup for it, and I don't deal in cmake. So unfortunately I won't be able to provide such in the foreseeable future.

I am not sure if I follow. It is basically testing conan new + conan create, to rule out other factors as recipe issues or library build scripts issues. Is this that happens in all packages, or just that json-schema-validator from ConanCenter?

SpaceIm commented 2 years ago

No issue in test_package of conan-center recipe for this profile: https://c3i.jfrog.io/c3i/misc/logs/pr/8884/1-configs/windows-visual_studio/json-schema-validator/2.1.0//424f5d9091d416d9b99ff0193c4cf7170cf01613-test.txt