summaryrefslogtreecommitdiff
path: root/eclass/cmake.eclass
AgeCommit message (Collapse)Author
2025-06-24cmake.eclass: Avoid false positives by ensuring we find a function callAndreas Sturmlechner
Otherwise the regex might pick up a query of the resulting version var, e.g.: > if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.12) Bug: https://bugs.gentoo.org/958923 Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2025-06-14cmake.eclass: Add src_install() check for CMake-4-incompatible modulesAndreas Sturmlechner
See examples: https://bugs.gentoo.org/953075 https://bugs.gentoo.org/957670 https://bugs.gentoo.org/957671 https://bugs.gentoo.org/957803 Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2025-06-14cmake.eclass: Avoid none-detection by ensuring match starts w/ digitAndreas Sturmlechner
Thanks-to: Ionen Wolkens <ionen@gentoo.org> Closes: https://bugs.gentoo.org/957990 Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2025-06-14cmake.eclass: mv _CMAKE_MINREQVER_UNSUPPORTED detection to src_prepareAndreas Sturmlechner
- _cmake_minverreq-lt(): New function for reusability of regex - Optimise #1: Reuse existing loop over CMakeLists.txt files - Optimise #2: If _CMAKE_MINREQVER_UNSUPPORTED is already set, then no further run of _cmake_minverreq-lt is necessary since we currently throw away the info on affected files - Relegate "CMake 4 detected; ..." to be a non-QA Notice, it is just an addendum Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2025-06-13cmake.eclass: Introduce _CMAKE_MINREQVER_UNSUPPORTEDAndreas Sturmlechner
Allows to split detection/eqawarn and applying cmakearg over different phases. Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2025-06-06cmake.eclass: quote "${file}" for sedsSam James
Otherwise sed may fail (as it can't find the files) on directories/files with spaces in the path, as is the case in dev-build/cmake itself where it'll die in src_prepare. Signed-off-by: Sam James <sam@gentoo.org>
2025-06-04cmake.eclass: _cmake_modify-cmakelists(): Consolidate the sedAndreas Sturmlechner
See also: https://github.com/gentoo/kde/pull/1046#pullrequestreview-2897140501 Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2025-06-04cmake.eclass: Improve _cmake_modify-cmakelists()Andreas Sturmlechner
50% less find 50% less grep 100% less cut Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2025-06-03cmake.eclass: Use get_makeopts_{jobs,loadavg}Michał Górny
See also: https://github.com/gentoo/gentoo/pull/39544 Signed-off-by: Michał Górny <mgorny@gentoo.org> Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2025-06-03cmake.eclass: Permit overriding CTEST_{JOBS,LOADAVG}Michał Górny
Bug: https://bugs.gentoo.org/945081 Signed-off-by: Michał Górny <mgorny@gentoo.org> Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2025-06-02cmake.eclass: CMake 4 QA check: Make sed case-insensitiveAndreas Sturmlechner
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2025-05-22cmake.eclass: EAPI=7: Extra slap on wristAndreas Sturmlechner
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2025-05-22cmake.eclass: CMake 4 QA notice: Use more wordsAndreas Sturmlechner
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2025-05-21cmake.eclass: CMake 4 QA check: Exit after first matchAndreas Sturmlechner
We don't want more than one version for the subsequent ver_test. Besides, any follow-up cmake_minimum_required call will most likely be conditional for some type of workarounds. Thanks-to: Michał Górny <mgorny@gentoo.org> Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2025-05-21cmake.eclass: CMake 4 QA check: Apparently, cmake allows double-dotsAndreas Sturmlechner
As a quick fix, for now, don't error out on that. > ERROR: media-gfx/darktable-5.0.1-r2::gentoo failed (configure phase): > __eapi7_ver_compare: invalid version: 3.12..16 See also: > LibRaw-cmake/CMakeLists.txt:cmake_minimum_required(VERSION 3.12..16) Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2025-05-20cmake.eclass: Add CMAKE_QA_COMPAT_SKIP flag to skip compat checksAndreas Sturmlechner
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2025-05-20cmake.eclass: If CMake 4 is detected, build w/ compat cmake argAndreas Sturmlechner
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2025-05-20cmake.eclass: Add recursive CMakeLists.txt unsupported version detectionAndreas Sturmlechner
We need to ramp up detection of unsupported CMake build systems with CMake 4. This will detect CMakeLists.txt files setting insufficient cmake_minimum_required VERSION level even in project subdirectories, putting out appropriate eqawarn message about the need to fix ${PN}. That makes us not rely on tinderbox runs w/ unmasked cmake-4 slowly being able to build everything up to leaf packages, and also helps detect insufficient subproject minimums that could otherwise be masked by USE flag choice. Bug: https://bugs.gentoo.org/951350 Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2025-04-23cmake.eclass: use 'QA Notice:' prefix in eqawarnSam James
This makes life easier for tinderboxes, but we should improve this in some future EAPI. Signed-off-by: Sam James <sam@gentoo.org>
2025-02-03eclass: Say belated happy new year as wellAndreas Sturmlechner
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2024-08-13cmake.eclass: If inherited from ecm.eclass, set ECM_DISABLE_GITAndreas Sturmlechner
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2024-08-13cmake.eclass: If inherited from ecm.eclass, set ECM_DISABLE_APPSTREAMTESTAndreas Sturmlechner
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2024-06-27cmake.eclass: Set CMAKE_COMPILE_WARNING_AS_ERROR=OFFAndreas Sturmlechner
Bug: https://bugs.gentoo.org/926121 Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2024-06-27cmake.eclass: Set CMAKE_TLS_VERIFY=ONAndreas Sturmlechner
Bug: https://bugs.gentoo.org/927160 Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2024-04-06cmake.eclass: bug 811486 escape find patternsNic Boet
Modify cmake_src_prepare to qoute escape filenames within the find search patterns This resolves build issues with some EAPI 7 packages, i.e. sys-fs/dislocker via catalyst Bug: https://bugs.gentoo.org/811486 Signed-off-by: Nic Boet <nic@boet.cc> Closes: https://github.com/gentoo/gentoo/pull/35125 Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2024-01-14cmake.eclass: dev-util/cmake -> dev-build/cmakeSam James
Signed-off-by: Sam James <sam@gentoo.org>
2024-01-13cmake.eclass: sys-devel/make -> dev-build/makeSam James
Signed-off-by: Sam James <sam@gentoo.org>
2024-01-03cmake.eclass: Set CMAKE_DISABLE_PRECOMPILE_HEADERS=ONAndreas Sturmlechner
Bug: https://bugs.gentoo.org/920845 Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2024-01-03cmake.eclass: Set FETCHCONTENT_FULLY_DISCONNECTED=ONAndreas Sturmlechner
Bug: https://bugs.gentoo.org/920846 Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2024-01-01*/*: Happy new yearAndreas Sturmlechner
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2023-09-16cmake.eclass: remove USER_VARIABLE from CMAKE_SKIP_TESTSIonen Wolkens
This is an array, and users cannot even set arrays through the environment. Must have been a copy/paste oversight (skipping ML review). Signed-off-by: Ionen Wolkens <ionen@gentoo.org> Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2023-09-16cmake.eclass: Remove duplicate eninja call from cmake_buildMichał Górny
Signed-off-by: Michał Górny <mgorny@gentoo.org> Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2023-09-16cmake.eclass: Support CMAKE_VERBOSE with ninjaMatt Turner
Signed-off-by: Matt Turner <mattst88@gentoo.org> Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2023-09-16cmake.eclass: workaround S=${WORKDIR} creating builddir above ${WORKDIR}Sam James
When S=${WORKDIR}, cmake.eclass would create its build directory (if CMAKE_USE_DIR is unset) above WORKDIR(!) as ${WORKDIR}_build. Creating directories above WORKDIR is not legal. Portage has its own bug (bug #889418) in that it doesn't clean up unknown directories above WORKDIR in PORTAGE_TMPDIR, so combined, you get a problem where "ebuild ... clean" doesn't actually clean things up at all, and you get very confusing issues if e.g. changing CC between runs. The explicit S=WORKDIR check isn't truly needed but it makes explicit our intent here. Bug: https://bugs.gentoo.org/889418 Closes: https://bugs.gentoo.org/889420 Signed-off-by: Sam James <sam@gentoo.org> Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2023-09-16cmake.eclass: Set CMAKE_SYSROOT when building with SYSROOT=Raul E Rangel
When performing a SYSROOT= build, the --sysroot parameter was not getting passed to the compiler if the CBUILD and CHOST matched. This results in the build attempting to use BROOT libraries and headers instead of the ones from the SYSROOT. This change will allow `llvm` to be built into a new SYSROOT. ROOT=/build/amd64-host emerge sys-devel/llvm Signed-off-by: Raul E Rangel <rrangel@chromium.org> Closes: https://github.com/gentoo/gentoo/pull/30658 Signed-off-by: James Le Cuirot <chewi@gentoo.org> Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2023-05-18cmake.eclass: Cleanup fatal banned functions and meta variablesAndreas Sturmlechner
All of this was ported away from long ago, cmake-utils.eclass was removed almost a year ago. Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2023-03-26cmake.eclass: Quote argument of ":" commandUlrich Müller
This avoids globbing, see: https://www.shellcheck.net/wiki/SC2223 Signed-off-by: Ulrich Müller <ulm@gentoo.org> Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2023-03-23cmake.eclass: Support dev-util/samuraiorbea
samurai is a ninja-compatible build tool written in C which works with cmake, meson and other users of ninja. It is feature-complete and supports most of the same options as ninja. Signed-off-by: orbea <orbea@riseup.net> Signed-off-by: Sam James <sam@gentoo.org> Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2023-03-23cmake.eclass: Set CMAKE_SYSROOT in toolchain file when necessaryJames Le Cuirot
We previously set CMAKE_FIND_ROOT_PATH, but CMAKE_SYSROOT also sets this and more. The latter is needed when cross-compiling Fortran code such as sci-libs/lapack. Without this, it uses the toolchain's default sysroot, adds a -L/usr/${CHOST}/usr/lib flag based on that, reads the libc.so.6 ld script from this directory, does not apply any sysroot to the paths within because the script is outside the sysroot, and finally fails when attempting to link the host's libc.so.6. Signed-off-by: James Le Cuirot <chewi@gentoo.org> Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2023-03-23eclass: standardize prologue/epilogueDavid Seifert
Closes: https://github.com/gentoo/gentoo/pull/30061 Signed-off-by: David Seifert <soap@gentoo.org> Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2023-03-23cmake.eclass: add base-system as @MAINTAINER too (align with dev-util/cmake)Sam James
Signed-off-by: Sam James <sam@gentoo.org> Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2023-03-23cmake.eclass: mark CMAKE_VERBOSE as @USER_VARIABLESam James
It's a policy requirement that ebuilds produce verbose logs, so ebuilds themselves must not set CMAKE_VERBOSE. But users can. Signed-off-by: Sam James <sam@gentoo.org> Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2023-03-22cmake.eclass: Set Python3_FIND_UNVERSIONED_NAMES FIRSTAndreas Sturmlechner
See also: https://gitlab.kitware.com/cmake/cmake/-/merge_requests/8287 Bug: https://bugs.gentoo.org/835799 Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2023-03-12cmake.eclass: handle quoted whitespace in MYCMAKEARGSMike Gilbert
This uses eval in a similar way to econf and meson.eclass. Closes: https://github.com/gentoo/gentoo/pull/29839 Signed-off-by: Mike Gilbert <floppym@gentoo.org> Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2023-01-02*/*: Happy new yearAndreas Sturmlechner
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2022-12-11cmake.eclass: comment typo fixSam James
Signed-off-by: Sam James <sam@gentoo.org> Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2022-12-11cmake.eclass: drop use_enable reference in @DESCRIPTIONSam James
This is from cmake-utils.eclass and the use_enable-style functions it refers to are long-banned. Signed-off-by: Sam James <sam@gentoo.org> Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2022-10-16cmake.eclass: add CMAKE_SKIP_TESTSAlfred Persson Forsberg
Signed-off-by: Alfred Persson Forsberg <cat@catcream.org> Closes: https://github.com/gentoo/gentoo/pull/27052 Signed-off-by: Sam James <sam@gentoo.org>
2022-06-08cmake.eclass: Prepare for makeopts_jobs default inf changeMichał Górny
Signed-off-by: Michał Górny <mgorny@gentoo.org> Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2022-03-25*.eclass: @ECLASS-VARIABLE renamed to @ECLASS_VARIABLEUlrich Müller
Bug: https://bugs.gentoo.org/835396 Signed-off-by: Ulrich Müller <ulm@gentoo.org> Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>