Cmake_minimum_version error

Hi there,

I’m following the directions to build avogadro from source, using the entirely of the openchemistry module. However, I’m running into the following error:

[  1%] Creating directories for 'msgpackc'
[  2%] Performing download step (download, verify and extract) for 'msgpackc'
-- Downloading...
   dst='/Users/ayan/Documents/OpenSource/Avogadro/build/Downloads/msgpack-3.3.0.tar.gz'
   timeout='none'
   inactivity timeout='none'
-- Using src='https://github.com/msgpack/msgpack-c/releases/download/cpp-3.3.0/msgpack-3.3.0.tar.gz'
-- [download 1% complete]
-- [download 4% complete]
-- [download 7% complete]
-- [download 8% complete]
-- [download 11% complete]
-- [download 16% complete]
-- [download 31% complete]
-- [download 34% complete]
-- [download 38% complete]
-- [download 51% complete]
-- [download 80% complete]
-- [download 83% complete]
-- [download 100% complete]
-- verifying file...
       file='/Users/ayan/Documents/OpenSource/Avogadro/build/Downloads/msgpack-3.3.0.tar.gz'
-- Downloading... done
-- extracting...
     src='/Users/ayan/Documents/OpenSource/Avogadro/build/Downloads/msgpack-3.3.0.tar.gz'
     dst='/Users/ayan/Documents/OpenSource/Avogadro/build/thirdparty/msgpack-c-cpp-3.1.0'
-- extracting... [tar xfz]
-- extracting... [analysis]
-- extracting... [rename]
-- extracting... [clean up]
-- extracting... done
[  3%] No update step for 'msgpackc'
[  4%] Performing patch step for 'msgpackc'
[  6%] Performing configure step for 'msgpackc'
CMake Warning (dev) in CMakeLists.txt:
  No project() command is present.  The top-level CMakeLists.txt file must
  contain a literal, direct call to the project() command.  Add a line of
  code such as

    project(ProjectName)

  near the top of the file, but after cmake_minimum_required().

  CMake is pretending there is a "project(Project)" command on the first
  line.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in CMakeLists.txt:
  cmake_minimum_required() should be called prior to this top-level project()
  call.  Please see the cmake-commands(7) manual for usage documentation of
  both commands.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- The C compiler identification is AppleClang 17.0.0.17000013
-- The CXX compiler identification is AppleClang 17.0.0.17000013
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error in CMakeLists.txt:
  No cmake_minimum_required command is present.  A line of code such as

    cmake_minimum_required(VERSION 4.0)

  should be added at the top of the file.  The version specified may be lower
  if you wish to support older CMake versions for this project.  For more
  information run "cmake --help-policy CMP0000".


-- Configuring incomplete, errors occurred!
make[2]: *** [thirdparty/msgpackc-prefix/src/msgpackc-stamp/msgpackc-configure] Error 1
make[1]: *** [thirdparty/CMakeFiles/msgpackc.dir/all] Error 2
make: *** [all] Error 2

I can actually fix this manually by editing the ./build/thirdparty/msgpack-c-cpp-3.1.0/CMakeLists.txt and adding a cmake_minimum_required(VERSION 3.19) at the top of that, but it seems like I shouldn’t need to do that since the top-level CMakeLists.txt in openchemistry sets that. If I do fix this manually, it progresses further until it hits a similar error for a different dependency.

Is there something obvious I’m doing wrong? I did some searches on the forums for related issues, and I can confirm that I am not building in the source tree. I’m on MacOS Sequoia (15.4.1), using CMake 4.0.2. Any help would be greatly appreciated – thanks!

I have some patches for cmake 4.x but haven’t merged them yet. I’ll see what I can do today.

For now, I’d try to stick to cmake 3.x if you want to build from source. If you’re using Mac (and homebrew), you can do something like brew install cmake@3.31.7

Thank you! I don’t think brew has cmake 3.31.7 anymore (or at least, I wasn’t able to do it that way) but downloading from cmake.org was sufficient.