conan icon indicating copy to clipboard operation
conan copied to clipboard

investigating consumer flags per compiler

Open memsharded opened this issue 7 months ago • 2 comments

Changelog: (Feature | Fix | Bugfix): Describe here your pull request Docs: https://github.com/conan-io/docs/pull/XXXX

Close https://github.com/conan-io/conan/issues/18613

memsharded avatar Aug 01 '25 11:08 memsharded

A ConanCenter recipe would look like:

            #if is_msvc(self):
                # Required for the __cplusplus check at
                # https://github.com/DCMTK/dcmtk/blob/DCMTK-3.6.8/config/include/dcmtk/config/osconfig.h.in#L1489
            #    self.cpp_info.components[target_lib].cxxflags.append("/Zc:__cplusplus")
            def myflags(consumer):
                if consumer.settings.get_safe("compiler") == "msvc":
                    return ["/Zc:__cplusplus"]
            self.cpp_info.components[target_lib].cxxflags = myflags

memsharded avatar Sep 24 '25 09:09 memsharded

With new changes, the recipe in ConanCenter could be just:

self.cpp_info.cxxflags = lambda c: ["/Zc:__cplusplus"] if is_msvc(c) else []

And fully transparent to the consumers

memsharded avatar Sep 24 '25 11:09 memsharded