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

Feature/language #16028

Draft
wants to merge 18 commits into
base: develop2
Choose a base branch
from
Draft

Conversation

memsharded
Copy link
Member

Changelog: Feature: New compiler.cstd setting for C standard
Changelog: Feature: Implemented compatibility.py default compatibility for different C standards
Changelog: Feature: Implement check_min_cstd, check_max_cstd, valid_max_cstd, valid_min_cstd, supported_cstd tools
Changelog: Feature: New languages = "C", "C++" class attribute to further automate settings management
Docs: https://github.com/conan-io/docs/pull/XXXX

Close #13777

@jcar87
Copy link
Contributor

jcar87 commented Apr 9, 2024

This is great!!

I wonder if we could address the usage of the stdcpp_library() helper.
Some recipes build libraries that have a pure "C" interface but encapsulate compiled C++ code. Downstream pure C consumers linking the static library will need to tell the linker that the standard C++ library needs to be linked as well:

Usually handled like this:

    def package_info(self):
        self.cpp_info.libs = ["zimg"]
        if not self.options.shared:
            libcxx = stdcpp_library(self)
            if libcxx:
                self.cpp_info.system_libs.append(libcxx)

This is not entirely robust, the downstream consumer may choose to use the static C++ library, which is valid - but Conan would add a conflicting flag.

Perhaps we can take advantage of this feature to make this logic redundant but also robust?

Copy link
Member

@RubenRBS RubenRBS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still need to decide if the profile detectino should fill a value for the cstd by default

ErniGH and others added 6 commits April 9, 2024 16:20
* feat add test to bazeldeps

* Fixed several bugs. Improved tests coverage

* Reverted

* Better name

---------

Co-authored-by: Francisco Ramirez de Anton <franchuti688@gmail.com>
* refactor apple_min_version_flag()

* Refactored all the apple module and where it was being used (AutotoolsToolchain and MesonToolchain for now)

* Fixed bad return

* Fixing tests

* Keeping legacy behavior in apple_min_version_flag function

* Preventing possible breaking change

---------

Co-authored-by: Francisco Ramirez de Anton <franchuti688@gmail.com>
* Add hide_url tests for git scm tool

* Add hide_url flag to clone and fetch_commit.

Resolves conan-io#15684

* Update conans/test/functional/tools/scm/test_git.py

* Update conans/test/functional/tools/scm/test_git.py

---------

Co-authored-by: Rubén Rincón Blanco <git@rinconblanco.es>
@memsharded
Copy link
Member Author

We have a problem with current approach:

  • If we define compiler.cstd=11 in profile
  • Use a conanfile.txt (no languages = "C", ... specification)
  • The cstd is always auto-removed
  • It is never passed to the toolchain (see failing test in 2a87015)

@memsharded
Copy link
Member Author

We have a problem with current approach:

  • If we define compiler.cstd=11 in profile
  • Use a conanfile.txt (no languages = "C", ... specification)
  • The cstd is always auto-removed
  • it is never passed to the toolchain (see failing test in 2a87015)

Users wanting to support local dev must use a conanfile.txt, not a conanfile.py?

@memsharded
Copy link
Member Author

I wonder if we could address the usage of the stdcpp_library() helper.

@jcar87 I am trying to check what would be the more idiomatic CMake way of doing this, but I can't find anything easy. Is there any property of targets that could be used for this? If that is the case, we could do it in CMakeDeps. If that is not the case, we might want to do it in CMakeToolchain, but that might have limitations like not usable for cmake-conan or not possible to use it per-target, while CMakeDeps will apply only to targets linking certain dependencies.

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

Successfully merging this pull request may close these issues.

[feature] Add cstd to compiler settings
6 participants