Mac Cmake Command Line

Posted by2 years ago
Archived

I've been using CMake for quite a few years now and I've always been simply generating make files or vcproj files and building my projects. Lately I've really tried to aggressively redo my project management so that everything is built out-of-source (b/c things are getting messier with different toolchains and targets) and i keep bumping into 'installing'. This is some concept that seems to live both in cmake and make

I'm honestly not even really understanding the basics of why it exists. On a Linux system is it just copying what you build to some system default locations? like /usr/lib and /usr/bin? Does the workflow expect me to run 'make install' as root each time? Does 'installing' lose it's meaning on Windows?

Every time I start to look into it, it seems to make everything very messy with generator functions with no added benefit for me as a developer.

This is way more complicated than it should be, but this is the way to install the command line tools for CMake on MacOS. Unfortunately, the default way to perform this installation fails for. CMake options can be executed from the command line as, e.g., the CMake command above could be exectuted as # e.g., to enable Makefile for local building of sphinx-based documentation cmake -DBUILDDOCUMENTATION:BOOL = ON.

Cmake Mac Install Command Line Tools

EDIT: It also doesn't seem to flow well with dependencies. If you have 2 unrelated projects that both use the same external library with different configurations - what will happen when you install both?

I feel like maybe I'm missing something important here. Or is this a feature most people are simply ignoring?

28 comments

Document your code

Every project on GitHub comes with a version-controlled wiki to give your documentation the high level of care it deserves. It’s easy to create well-maintained, Markdown or rich text documentation alongside your code.

Sign up for free See pricing for teams and enterprises

This is how we compile otclient on Mac OS X, we use XQuartz to compile and run otclient, which is a X11 implementation for Mac OS, we do not use the native Cocoa API. This means that users will need XQuartz installed too to run the client. You will need to know the basics on how using terminal in Mac OS to follow this tutorial.

Requirements

  • Mac OS X 10.6 or higher
  • Command Line Tools for Xcode (install them inside the XCode menu)

You should install all those requirements first, in order, I will not cover how to install them in this tutorial.

Installing needed libraries

We use brew to install most of the required libraries by using the following commands:

Install LUA 5.1.5

Observation: If you cant curl, you'll need to enter http://www.lua.org/ftp/lua-5.1.5.tar.gz and download manually the file

Mac Os Cmake Command Line

Cloning and compiling

You may need to change the included directory of your installed version of OPENSSL. Check your installed version with brew info openssl. If it is not version 1.0.2.n, change the version in the cmake command below.

Mac Cmake Command Line Switches

Now you can run, the otclient output binary should be in the same directory.

Mac Cmake Command Line

Osx Cmake Command Line

Clone this wiki locally