Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolved runtime MT problem #3

Merged
merged 1 commit into from
Oct 28, 2021
Merged

Conversation

franramirez688
Copy link

@franramirez688 franramirez688 commented Oct 27, 2021

Issue related: conan-io/conan#9537 (comment)

Added manually -MT runtime to CC/CXX flags.

@franramirez688 franramirez688 changed the title Solved find_package and link problems Solved link problems Oct 27, 2021
@arttet
Copy link
Owner

arttet commented Oct 27, 2021

Hi @franramirez688

I ran the following command:

conan new hello/0.1 --template=cmake_lib

P.S. https://docs.conan.io/en/latest/reference/conanfile/tools/cmake/cmake.html

@franramirez688
Copy link
Author

@arttet My PR has build_type=Debug and the pipeline is still using Release one

[settings]
arch=x86_64
arch_build=x86_64
arch_target=x86_64
build_type=Release
compiler=clang
compiler.cppstd=17
compiler.libcxx=libstdc++11
compiler.runtime=MT
compiler.version=13
os=Windows
os_build=Windows
[options]
[build_requires]
[env]
CC=C:/Program Files/LLVM/bin/clang
CFLAGS=-fsanitize=address
CXX=C:/Program Files/LLVM/bin/clang++
CXXFLAGS=-fsanitize=address
...

I don't why it's not using the PR settings instead

@arttet
Copy link
Owner

arttet commented Oct 27, 2021

Because of .github/workflows/build.yml

@franramirez688
Copy link
Author

franramirez688 commented Oct 27, 2021

Hi @franramirez688

I ran the following command:

And it's fine indeed. What I meant is that you're using as well:

    generators = "CMakeDeps", "CMakeToolchain"

So it's not necessary to declare a generate() method to use the default declarations. Have a look at this section.

@arttet
Copy link
Owner

arttet commented Oct 27, 2021

Hi @franramirez688

Could you please tell me how to add cmake_definitions using new CMake.
I tried to use the following command:

cmake.definitions["WITH_TESTS"] = self.options.tests

But I got the following error:

        cmake.definitions["WITH_TESTS"] = self.options.tests
        AttributeError: 'CMake' object has no attribute 'definitions'

@arttet
Copy link
Owner

arttet commented Oct 27, 2021

Is this the right way?

    def generate(self):
        tc = CMakeToolchain(self)
        tc.variables["WITH_TESTS"] = self.options.tests
        tc.generate()

@franramirez688
Copy link
Author

franramirez688 commented Oct 27, 2021

Hi @franramirez688

Could you please tell me how to add cmake_definitions using new CMake. I tried to use the following command:

I guess what you're looking for is here

Now, you can define them as the following example:

def generate(self):
    tc = CMakeToolchain(self)
    tc.preprocessor_definitions["MYDEF"] = "MyValue"
    tc.preprocessor_definitions.debug["MYCONFIGDEF"] = "MyDebugValue"
    tc.preprocessor_definitions.release["MYCONFIGDEF"] = "MyReleaseValue"
    tc.generate()

It's the same as using add_definitions() in CMake.
If you use variables is like set() instead.

@arttet
Copy link
Owner

arttet commented Oct 27, 2021

OK, thank you

@franramirez688 franramirez688 changed the title Solved link problems Resolved runtime MT problem Oct 28, 2021
@franramirez688
Copy link
Author

Hi @arttet

Finally, I could add a workaround 😁
Certainly, Conan needs to manage better the MT runtime for Clang use cases because it's not doing it at all right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants