Conan: Filter cmake_args that should not be included in package_id

The qtbase Conan recipe has 'cmake_args_qtbase" option to pass cmake
arguments. Some of the cmake arguments should not be included in the
package_id checksum of the Conan package. Filter these out when
generating the package_id.

Examples:
  - -DCMAKE_C_COMPILER_LAUNCHER=sccache
  - -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
  - -DFEATURE_headersclean=..
  - -DPostgreSQL_ROOT=..

Those arguments which are specific to Qt CI build environment are
filtered out. This makes the pre-built Conan binary packages more
usable for the end users because Conan would enforce a build
from sources if the checksum(s) would not match.

Pick-to: 6.2
Task-number: QTBUG-96230
Change-Id: I076a57427614fdf4bf9138402e247d63f1ce15d9
Reviewed-by: Toni Saario <toni.saario@qt.io>
This commit is contained in:
Iikka Eklund 2021-09-07 11:48:11 +03:00
parent 30e2f51dab
commit d96fe5e753

View File

@ -460,6 +460,13 @@ class QtBase(ConanFile):
for item in rm_list: for item in rm_list:
if item in self.info.options: if item in self.info.options:
delattr(self.info.options, item) delattr(self.info.options, item)
# filter also those cmake options that should not end up in the package_id
if hasattr(self.info.options, "cmake_args_qtbase"):
_filter = self.python_requires[
"qt-conan-common"
].module.filter_cmake_args_for_package_id
self.info.options.cmake_args_qtbase = _filter(self.info.options.cmake_args_qtbase)
def deploy(self): def deploy(self):
self.copy("*") # copy from current package self.copy("*") # copy from current package