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

Conan v2 #2805

Merged
merged 9 commits into from
Feb 17, 2024
Merged

Conan v2 #2805

merged 9 commits into from
Feb 17, 2024

Conversation

LinuxDevon
Copy link
Contributor

Description

This is to address the warnings and upcoming Conan 1 deprecation.

I compared the changes of the package before and after. I took a snapshot of the directory using conan 1 before changes. Then one with conan 2 after.

See the text files:

I added a build yaml for conan versions i tested against. I didn't do any c++ versioning or gcc testing since that is done with the other builds. I simply wanted to ensure that conan ran and could build against the test package. I kept backwards compatibility with v1.

There is a .conan/build.py file i was debating about removing. I don't think it is used but if it is how? The conan-package-tools don't work with conan 2.0. There aren't plans to support so not sure if that changes things as well.

GitHub Issues

#2700

updated the test_package to be updated to conan 2 and fixed missing cmake. Still need to check that the license file is packaged up and that the packages look identical before the changes
Adding a package build yaml to ensure conan keeps building on 1 and 2
Copy link

codecov bot commented Feb 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (1078e7e) 91.36% compared to head (a041943) 91.37%.
Report is 9 commits behind head on devel.

Additional details and impacted files
@@            Coverage Diff             @@
##            devel    #2805      +/-   ##
==========================================
+ Coverage   91.36%   91.37%   +0.01%     
==========================================
  Files         197      197              
  Lines        8285     8285              
==========================================
+ Hits         7569     7570       +1     
+ Misses        716      715       -1     

conanfile.py Outdated
self.cpp_info.components["catch2base"].builddirs.append("lib/cmake/Catch2")

# Catch2WithMain
self.cpp_info.components["catch2main"].set_property("cmake_file_name", "Catch2WithMain")
Copy link
Contributor

Choose a reason for hiding this comment

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

Please do specify cmake_target_name similar to
https://github.com/conan-io/conan-center-index/blob/master/recipes/catch2/3.x.x/conanfile.py#L168

That way you would be able to correctly use Catch2::Catch2WithMain target instead of the lowercase.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think i did this. I kept the cmake_file_name but not sure if that matters.

I also didn't realize that the conan file for conan.io is separate from this repo. So will this close the issue in reference? Maybe if it is maintained over there we just drop the conan files here

Copy link
Contributor

Choose a reason for hiding this comment

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

The Conan Center policy is to maintain recipes for the default repo so in-source conanfiles are only needed for project-specific development. I'm not sure how many people require it so it's up to the maintainer in here to decide if it's still needed.

Regarding this specific PR - cmake_target_name is used for the target name. It needs to be specified with namespace because of the different filename to namespace to target to component conventions different projects have. cmake_file_name is needed only for the find_package syntax, it's not useful for components and it doesn't make sense to specify the target name in there. The global level cmake_target_name I think refers to the target which is wired on Conan-level global component dependencies, it's not actually used in CMake.

Additionally, prefer os.path.join over the / directory separator for cross-environment compatibility.

@horenmar horenmar added the Building and Packaging Issues affecting build/packaging scripts and utilities label Feb 17, 2024
@horenmar horenmar merged commit 62d4aec into catchorg:devel Feb 17, 2024
3 checks passed
@horenmar
Copy link
Member

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Building and Packaging Issues affecting build/packaging scripts and utilities
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants