0

I'm trying to build Blender as a Python module on Mac OS X El Capitan. I'm following this tutorial for building Blender as Python module and this tutorial for building Blender in general. My experience is as follows. I can run CMake without any errors with the default settings. However, I want to build Blender as a Python module, and this page indicates that while I'm running CMake, I need to set:

WITH_PYTHON_INSTALL=OFF
WITH_PLAYER=OFF
WITH_PYTHON_MODULE=ON

When I set these options as above, I get the following error:

CMake Error at source/creator/CMakeLists.txt:223 (set_target_properties):
  set_target_properties called with incorrect number of arguments.

I've tried both command line CMake and CMake GUI, with the same error. I know nothing about CMake, so I'm very lost as to how to resolve this. I've looked at line 223 of source/creator/CMakeLists.txt as the error message indicated, and it has the following lines.

if(APPLE)
    set_target_properties(
        blender
        PROPERTIES
            MACOSX_BUNDLE
            LINK_FLAGS_RELEASE "${PLATFORM_LINKFLAGS}"
            LINK_FLAGS_DEBUG "${PLATFORM_LINKFLAGS_DEBUG}"
    )
endif()

How do I resolve this error?

1
  • Looks like value for MACOSX_BUNDLE property is missed. According to the property documentation, its value may be either false-like (e.g. "FALSE") or true-like (e.g. "TRUE"). Unsure which one is intended of the author of this code.
    – Tsyvarev
    May 12, 2016 at 17:40

1 Answer 1

1

The target property MACOSX_BUNDLE does need a parameter:

if(APPLE)
    set_target_properties(
        blender
        PROPERTIES
            MACOSX_BUNDLE TRUE
            LINK_FLAGS_RELEASE "${PLATFORM_LINKFLAGS}"
            LINK_FLAGS_DEBUG "${PLATFORM_LINKFLAGS_DEBUG}"
    )
endif()

Seems to be a bug in source/creator/CMakeLists.txt.

This came with a commit a while ago: [Bf-blender-cvs] [4828c6a] master: cmake: fix generation / install on OS X, N.B. needs cmake cache rebuild

3
  • Wow THANK YOU! Are you involved in the Blender project then? You sound like it.
    – Ray
    May 12, 2016 at 22:50
  • @Ray You're welcome. No, I'm not involved in the Blender project. Just - like Tsyvarev - I'm using CMake for a quite a while now and just looking at the error message and the code the problem is very obvious. It started me wondering how this could ever have been working, so I checked the latest version (which still has the problem) and then were looking into when and by whom this was added (which seems to be quite a while ago by Martijn Berger). I just noticed the if has changed from if(WITH_PYTHON_MODULE) to if(APPLE) since then. Seem someone has noticed a problem with the code.
    – Florian
    May 13, 2016 at 6:56
  • @Ray Please report this problem to the Blender project team, so they may review and fix it.
    – Florian
    May 13, 2016 at 6:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.