On 10 May 2025 at 12:34, Tyler wrote:
| I recently submitted the package `libdeflate`, which successfully made
| its way to the CRAN
| (https://cran.r-project.org/web/packages/libdeflate/index.html) but
| has failed to install on macOS:
[...]
| I see that WRE also recommends checking
| "/Applications/CMake.app/Contents/bin/cmake" on macOS. Before
| submitting an update, though, it would be nice if someone could
| confirm where cmake is located on the CRAN macOS environment so I can
| be sure the fix will be successful.

It's a common issue, it's documented, and a pothole I also fell into not that
long ago. So here is a very simple script `configure` I use to check, and
then adjust src/Makevars, in package crc32c (which wraps a small external
library of the same name). You will note it credits Reed from an earlier
discussion on this very list.

-----------------------------------------------------------------------------
#!/bin/sh

## With thanks to Reed A. Cartwright on r-package-devel on 2023-05-10
## Also end of Writing R Extensions, Section 1.2.6 'Using `cmake`'

if test -z "$CMAKE"; then
   # Look for a cmake binary in the current path
   CMAKE=`which cmake 2>/dev/null`
fi
if test -z "$CMAKE"; then
   # Check for a MacOS specific path
   CMAKE=`which /Applications/CMake.app/Contents/bin/cmake 2>/dev/null`
fi
if test -f "$CMAKE"; then
   echo "** cmake is ${CMAKE}"
else   
   echo "The 'cmake' program is required but not found."
   exit 1
fi   

sed -e "s|@cmake@|${CMAKE}|" src/Makevars.in > src/Makevars
-----------------------------------------------------------------------------


By the way, a hidden gem of documentation is the ability to search all
current CRAN packages with the mirror at https://github.com/cran/

Cheers, Dirk

-- 
dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org

______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Reply via email to