Install GMT from source on MacOS - CMakeLists.txt

Dear Gurus,

first time for me installing GMT from source on MacOS.

mbp15-kristof:cmake kristof$ mkdir build
mbp15-kristof:cmake kristof$ cd build/
mbp15-kristof:build kristof$ cmake ..
CMake Error: The source directory "/Users/kristof/Documents/github/gmt/cmake" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
mbp15-kristof:build

I found CMakeLists.txt in cmake/dist/ but cmake seems not to find it there?

Chances are high I’m doing something stupid here so a nudge in the right direction is greatly appreciated.

Thank you,
Kristof

Ok, I experimented a bit more and in the end just copied CMakeLists.txt into the cmake folder.

mbp15-kristof:build kristof$ cmake ..
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.

-- The C compiler identification is AppleClang 11.0.0.11000033
-- The CXX compiler identification is AppleClang 11.0.0.11000033
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error: File /Users/kristof/Documents/github/gmt/cmake/startup_macosx.sh.in does not exist.
CMake Error at CMakeLists.txt:166 (configure_file):
  configure_file Problem configuring file


CMake Error: File /Users/kristof/Documents/github/gmt/cmake/Info.plist.in does not exist.
CMake Error at CMakeLists.txt:167 (configure_file):
  configure_file Problem configuring file


CMake Error at /usr/local/Cellar/cmake/3.16.5/share/cmake/Modules/CPack.cmake:540 (message):
  CPack package description file:
  "/Users/kristof/Documents/github/gmt/cmake/cpack_package_description.txt"
  could not be found.
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.16.5/share/cmake/Modules/CPack.cmake:544 (cpack_check_file_exists)
  CMakeLists.txt:222 (include)


CMake Warning (dev) in CMakeLists.txt:
  No cmake_minimum_required command is present.  A line of code such as

    cmake_minimum_required(VERSION 3.16)

  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".
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring incomplete, errors occurred!
See also "/Users/kristof/Documents/github/gmt/cmake/build/CMakeFiles/CMakeOutput.log".
mbp15-kristof:build kristof$

A little bit further but still no luck. Maybe someone can help me on this?

It seems you’re running mkdir build; cd build; cmake .. commands in the cmake directory. That’s incorrect. You should run these commands in the top directory, so that you have the build, src and cmake directories in the same level.

Or you can create the build directory wherever you want and then say,

cd build
cmake /Users/kristof/Documents/github/gmt
make

@seisman thank you for pointing this out. You are absolutely right. So yes, I did something stupid there … works perfectly fine now.

@Joaquim thats a great idea to keep things separated. Thank you