0

When using CMake / CPack to build packages, there are CPACK_DEBIAN_PACKAGE_DEPENDS and CPACK_RPM_PACKAGE_REQUIRES to hold a list of packages the resulting .deb / .rpm should depend on.

The distinction is helpful, as package naming shemes differ between distributions. (Example: Distros using .debs add the major version of libicu to the package name -- i.e., libicu60 -- whereas distros using .rpms don't.)

However, there are differences between .rpm-distros as well, most notably between SuSE and RedHat. For example, SuSE names Boost packages libboost_system1.56.0 etc., whereas RedHat uses boost-system.

Is there an ideomatic way to either

  • maintain CPACK_RPM_PACKAGE_REQUIRES in a distro-agnostic way, or
  • detect the particular distribution / package naming pattern?

I know ways to figure out the distribution "the hard way" (parsing uname, checking files in /etc and so on) and then "hardcode" the individual package names into CPACK_RPM_PACKAGE_REQUIRES; I was wondering if CMake / CPack offered a more idiomatic way to approach the issue.

DevSolar
  • 67,862
  • 21
  • 134
  • 209

1 Answers1

1

I was wondering if CMake / CPack offered a more idiomatic way to approach the issue.

No, it doesn't. (at least yet).

The "hardcode" way is the only way nowadays. To the things that you've mentioned, I'd add running lsb-release if available, parse /etc/lsb-release and/or other distro-specific things from /etc...

zaufi
  • 6,811
  • 26
  • 34