Conan: What is compiler.libcxx set to in a C only package?

Created on 8 Sep 2017  路  2Comments  路  Source: conan-io/conan

I am cross compiling, from Linux to Windows, a C only shared library, DLL, using mingw. I then use this package in a C++ project that is built with Visual Studio. All other packages are built naively with Visual Studio C++ compiler. I don't have any issues with creating this package, I am doing the same things that I do for a C++ package. However, when I try to install my dependencies:

conan install ..\ -s CSharedLib:compiler=gcc -s CSharedLib:compiler.version=4.9

I get the following error:

ERROR: CSharedLib/0.0.1@channel/stable: 'settings.compiler.libcxx' value not defined

I have searched your blog posts that covers multi compiler projects but could not find the solution to my issue. I do not have mingw installed on Windows and also don't want to install it.

So, my questions are:

  • Is there a way to differentiate between C and C++ only packages? I am specifically looking for something like enable_langauge in CMake.

    • How should I handle compiler.libcxx to resolve my problem?
question

Most helpful comment

Add a configure method in the recipe and remove the setting:

 def configure(self):
        del self.settings.compiler.libcxx

This way Conan won't request a value for the setting, because the recipe doesn't needs it anymore. It's the way to go with the pure C libraries. You can take a look to the "conan new" command to generate base layouts for the recipes, the --pure_c parameter will create these lines for you.

There is no method to differentiate C/C++ recipes, normally they can coexist if the user knows what libraries are using.

All 2 comments

Add a configure method in the recipe and remove the setting:

 def configure(self):
        del self.settings.compiler.libcxx

This way Conan won't request a value for the setting, because the recipe doesn't needs it anymore. It's the way to go with the pure C libraries. You can take a look to the "conan new" command to generate base layouts for the recipes, the --pure_c parameter will create these lines for you.

There is no method to differentiate C/C++ recipes, normally they can coexist if the user knows what libraries are using.

I have added an entry to the FAQ, I guess this issue can be closed now, thanks!

Was this page helpful?
0 / 5 - 0 ratings