Sunday, December 3, 2017

Compiling Maya 2018 plugins with CMake on Mac OSX

In addition to this post I have just spent a couple of hours trying to get my plugins to compile in maya 2018 and finally succeeded so I thought I'd share this here in case someone else has the same issues getting it to work.


I tested this on MacOS HighSierra so I cant guarantee it works with other versions too (yes I did set a root password ☝)

First of all the maya developer kit is now download only and doesn't ship with maya anymore.

Head over to the Autodesk website and download it. From the archive extract the three folders /devkit /include and /mkspec into the maya folder.


Your folder structure should then look like this:

  • /Applications/Autodesk/maya2018/devkit
  • /Applications/Autodesk/maya2018/mkspecs
  • /Applications/Autodesk/maya2018/include
  • /Applications/Autodesk/maya2018/Maya.app

Now you need to get the latest FindMaya.cmake from Chad Vernons Github and make sure your project points to it.

In your projects CMakeLists.txt now make sure to set the project to Maya 2018 by defining this



If you compile now you might get the following warning from CMake:

-- Configuring done
CMake Warning (dev):
  Policy CMP0042 is not set: MACOSX_RPATH is enabled by default.  Run "cmake
  --help-policy CMP0042" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  MACOSX_RPATH is not specified for the following targets:


Its just a warning but in order to disable it you might want to also set this in CMakeSettings.txt


Now when you compile you will get spammed with a huge amount of error messages and foremost the issue here is that cmake doesnt tell maya for which platform you want to compile.

The way you would do it in C++ is usually with a preprocessor directive like so:

#define OSMac_

In CMake you can do this with  add_definitions() and the -D argument. It looks slightly confusing but the full command you have to add to your CMakeLists.txt is this:


In my case the full projects CMakeList.txt now looks like the following:


This is it, you should now be able to compile. Hope this was useful for you.


No comments:

Post a Comment