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

Remove architecture check from CMake package #225

Merged
merged 1 commit into from
Apr 16, 2019

Conversation

mmha
Copy link
Contributor

@mmha mmha commented Apr 15, 2019

Description

CMake adds an architecture check to each package by default. This causes the package to break if e. g. the package was built on a 32 bit system and used on a 64 bit system, even though this is a header-only library. This can happen if a caching package manager like conan is being used.

In CMake 3.14 this check can be disabled by passing ARCH_INDEPENDENT to write_basic_package_version_file. In versions prior to that CMAKE_SIZEOF_VOID_P needs to be unset for the duration of this function.

GitHub Issues

catchorg/Catch2#1368

@onqtam
Copy link
Member

onqtam commented Apr 16, 2019

Thanks!

@onqtam onqtam merged commit 0872123 into doctest:dev Apr 16, 2019
@Morwenn
Copy link

Morwenn commented Apr 22, 2019

Is this something that happens despite specifying header_only in package_info in the conanfile?

@mmha
Copy link
Contributor Author

mmha commented Apr 22, 2019

This happens because specifying header_only in package_info.

When stating to conan that it's a header-only lib, you're telling conan that you can reuse the built package for all architectures and OSes.

The docs say this:

That means, if someone consumes MyLib with the header_only=True option, the package downloaded and used will be the same, irrespective of the OS, compiler or architecture the consumer is building with.

But the CMake write_basic_package_version_file does add a platform check, which makes CMake install()ed header-only libs platform-dependent unless worked around (which is what this PR did).

@Morwenn
Copy link

Morwenn commented Apr 22, 2019

Nice & concise explanation, thank you very much!

gummif added a commit to gummif/cppzmq that referenced this pull request Jan 15, 2020
Solution: Remove architechture checks from cmake version file

Since this is a header only library there is no need to check for 32 vs 64bits.

See similar problem: doctest/doctest#225
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.

3 participants