Skip to content
Open

Cmake #295

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions classes/cmake.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
inherit: [cpackage, ninja, install, licenses]
inherit: [cpackage, ninja, install, licenses, make]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid that doesn't work this way. After merging #282, the ninja and make classes set different values for the jobServer key. 😕

The only way forward that I see is to move the common parts of this class to classes/basement/bits/cmake.yaml and create a new class cmake-make that does inherit: ["basement::bits::cmake", make].

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😢 Bad timing... I have not rebased to #282...

I need this for only one package. I'll move make-inherit to the recipe and leave only the CMAKE_GENERATOR change here..

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems fragile. I just had another idea. We could set jobServer: "fifo" explicitly in the cmake class again with a big, fat comment explaining why. This mode is compatible with both tools...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If make understands fifo as well why do we not simply set jobServer: "fifo" in the make-class?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will fail if you start Bob from an old make. See here. OTOH, as soon as you hit a cmake/ninja recipe, this will happen anyway. Looking back, it should probably be a warning and just not pass the incompatible job server instead of failing.

Having said that, it sounds like an artificial problem. So using "fifo" consistently looks like the best way forward. Let's do it this way...


buildToolsWeak: [cmake]
buildVars: [AUTOCONF_HOST, AR, CC, CXX]
buildVars: [AUTOCONF_HOST, AR, CC, CXX, CMAKE_GENERATOR]
buildSetup: |
# Make sure CMake finds other stuff by its own logic too
CMAKE_FIND_ROOT_PATH=
Expand Down Expand Up @@ -144,7 +144,7 @@ buildSetup: |
pushd build

cmake "$1" \
-G Ninja \
-G "${CMAKE_GENERATOR:-Ninja}" \
${CMAKE_TOOLCHAIN_FILE:+-DCMAKE_TOOLCHAIN_FILE="$CMAKE_TOOLCHAIN_FILE"} \
-DCMAKE_FIND_ROOT_PATH="$CMAKE_FIND_ROOT_PATH" \
-DCMAKE_BUILD_TYPE=Bob \
Expand All @@ -155,9 +155,13 @@ buildSetup: |
-DCMAKE_MSVC_RUNTIME_LIBRARY="" \
"${@:2}"

ninjaParallel ${MAKE_OPTIONS:+"${MAKE_OPTIONS[@]}"} \
${MAKE_TARGETS:+"${MAKE_TARGETS[@]}"}

if [[ "${CMAKE_GENERATOR:-Ninja}" == Ninja ]]; then
ninjaParallel ${MAKE_OPTIONS:+"${MAKE_OPTIONS[@]}"} \
${MAKE_TARGETS:+"${MAKE_TARGETS[@]}"}
elif [[ "${CMAKE_GENERATOR:-Ninja}" == 'Unix Makefiles' ]]; then
makeParallel ${MAKE_OPTIONS:+"${MAKE_OPTIONS[@]}"} \
${MAKE_TARGETS:+"${MAKE_TARGET[@]}"}
fi
if [[ -n "$INSTALL" ]] ; then
DESTDIR="${PWD}/../install" cmake \
${INSTALL_COMPONENT:+-DCOMPONENT="$INSTALL_COMPONENT"} \
Expand Down
10 changes: 10 additions & 0 deletions classes/compat/cmake-3.31.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
inherit: [cmake]

depends:
- name: devel::cmake
environment:
DEVEL__CMAKE_VERSION: "3.31.10"
DEVEL__CMAKE_DIGEST: "cf06fadfd6d41fa8e1ade5099e54976d1d844fd1487ab99942341f91b13d3e29"
use: [tools]
tools:
target-toolchain: host-compat-toolchain
2 changes: 1 addition & 1 deletion classes/make.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
jobServer: "fifo-or-pipe"
jobServer: "fifo"
buildToolsWeak: [make]
buildVarsWeak: [MAKE_JOBS]
buildSetup: |
Expand Down
5 changes: 3 additions & 2 deletions recipes/devel/cmake.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
inherit: [patch]

metaEnvironment:
PKG_VERSION: "3.25.1"
PKG_VERSION: "${DEVEL__CMAKE_VERSION:-4.2.1}"
PKG_LICENSE: "BSD-3-Clause"

checkoutSCM:
scm: url
url: ${GITHUB_MIRROR}/Kitware/CMake/releases/download/v${PKG_VERSION}/cmake-${PKG_VERSION}.tar.gz
digestSHA256: 1c511d09516af493694ed9baf13c55947a36389674d657a2d5e0ccedc6b291d8
digestSHA256: "${DEVEL__CMAKE_DIGEST:-414aacfac54ba0e78e64a018720b64ed6bfca14b587047b8b3489f407a14a070}"
stripComponents: 1

checkoutDeterministic: True
Expand Down Expand Up @@ -40,6 +40,7 @@ multiPackage:
-DKWSYS_LFS_WORKS=TRUE \
-DKWSYS_CHAR_IS_SIGNED=TRUE \
-DCMAKE_USE_SYSTEM_LIBRARIES=1 \
-DCMAKE_USE_SYSTEM_LIBRARY_CPPDAP=OFF \
-DCTEST_USE_XMLRPC=OFF \
-DBUILD_CursesDialog=OFF

Expand Down
22 changes: 12 additions & 10 deletions recipes/devel/cmake/0001-fix-curl-lib-deps.patch
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,29 @@ Fix CURL find package module
The current implementation does not account for transitive dependencies of
cURL. Add what is strictly necessary to get it compiled in our environment.

diff -Nurp a/Modules/FindCURL.cmake b/Modules/FindCURL.cmake
--- a/Modules/FindCURL.cmake 2022-11-30 14:57:03.000000000 +0100
+++ b/Modules/FindCURL.cmake 2022-12-05 21:25:34.000000000 +0100
@@ -185,13 +185,19 @@ find_package_handle_standard_args(CURL
diff -Nurp a/Modules/FindCURL.cmake b/Modules/FindCURL.cmake
--- a/Modules/FindCURL.cmake 2025-12-08 19:33:58.000000000 +0100
+++ b/Modules/FindCURL.cmake 2026-01-21 14:42:55.650870435 +0100
@@ -291,7 +291,7 @@ find_package_handle_standard_args(CURL
HANDLE_COMPONENTS)

if(CURL_FOUND)
- set(CURL_LIBRARIES ${CURL_LIBRARY})
+ set(CURL_LIBRARIES ${CURL_LIBRARY} ${PC_CURL_LIBRARIES})
set(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIR})

if(NOT TARGET CURL::libcurl)
add_library(CURL::libcurl UNKNOWN IMPORTED)
@@ -299,6 +299,13 @@ if(CURL_FOUND)
set_target_properties(CURL::libcurl PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}")

+ if(PC_CURL_FOUND)
+ set(CURL_DEPENDENCY_LIBRARIES "${PC_CURL_LIBRARIES}")
+ list(REMOVE_ITEM CURL_DEPENDENCY_LIBRARIES curl)
+ set_target_properties(CURL::libcurl PROPERTIES
+ INTERFACE_LINK_LIBRARIES "${CURL_DEPENDENCY_LIBRARIES}")
+ endif()

if(EXISTS "${CURL_LIBRARY}")
set_target_properties(CURL::libcurl PROPERTIES
+
if(CURL_USE_STATIC_LIBS)
set_property(TARGET CURL::libcurl APPEND PROPERTY
INTERFACE_COMPILE_DEFINITIONS "CURL_STATICLIB")