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

feat: install cmake config module in arch-indep location #257

Closed
wants to merge 1 commit into from

Conversation

pinotree
Copy link
Contributor

toml11 is an header-only library, and the exported cmake target for it only points to the headers; because of this, it seems a good idea to install the cmake config module in an architecture-independent location for cmake, rather than under a library (architecture-dependent) location.

Doing so is easy:

  • tweak TOML11_INSTALL_CMAKE_DIR to point to a cmake subdirectory of the shared dataroot location (typically $prefix/share)
  • pass ARCH_INDEPENDENT argument to write_basic_package_version_file(): this is because the cmake config module generated by default contains the architecture bits check (32bit vs 64bit vs ...); since it does not matter in this case, make the config module arch-independent

toml11 is an header-only library, and the exported cmake target for it
only points to the headers; because of this, it seems a good idea to
install the cmake config module in an architecture-independent location
for cmake, rather than under a library (architecture-dependent)
location.

Doing so is easy:
- tweak TOML11_INSTALL_CMAKE_DIR to point to a cmake subdirectory of the
  shared dataroot location (typically $prefix/share)
- pass ARCH_INDEPENDENT argument to write_basic_package_version_file():
  this is because the cmake config module generated by default contains
  the architecture bits check (32bit vs 64bit vs ...); since it does
  not matter in this case, make the config module arch-independent
@pinotree pinotree force-pushed the cmake-module-arch-indep branch from 6b7ede4 to 4d2e099 Compare July 21, 2024 16:00
@ToruNiina
Copy link
Owner

Thank you for the suggestion!

But, actually toml11 optionally supports precompiled library (libtoml11.a) that includes some deinline-ized functions and explicit specialization of frequently used functions (e.g. toml::parse<toml::type_config>). When -DTOML11_PRECOMPILE=ON, cmake will build binary and install it.
Since CMake says ARCH_INDEPENDENT is intended for packages with no binaries, it seems to be better not to use it in that case.

We can check TOML11_PRECOMPILE variable in cmake, but it makes script a bit complicated and harder to maintain.
I looked some of the libraries that supports both header-only and compiled modes, and many of them just uses LIBDIR in both modes (though I don't know they actually intended to do that). I will also take the same approach here.
So, I am sorry but I am closing this. I appreciate your cooperation. If you find anything else, please feel free to send it.

@ToruNiina ToruNiina closed this Jul 21, 2024
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.

2 participants