C-Make Error in the file called CMakeLists.txt

Hello, Blender community!

As a newcomer to Blender, I’ve encountered an error while attempting to run the mesh_ops.c file on Visual Studio Code 2022. Unfortunately, this error is preventing me from successfully running my file. Note: My operating system is a Windows 10.

Severity Code Description Project File Line Suppression State
Error CMake Error at blender/datatoc/CMakeLists.txt:22 (setup_platform_linker_flags):
Unknown CMake command “setup_platform_linker_flags”. D:\481581DOCS\blender\source\blender/datatoc/CMakeLists.txt 22

I’m new to using CMake and building projects, and I’ve encountered an error in the CMakeList file. The code snippet where the error appears looks like this:


# -----------------------------------------------------------------------------
# Build datatoc executable
set(SRC
  datatoc.c
)

# SRC_DNA_INC is defined in the parent dir
add_executable(datatoc ${SRC})


# -----------------------------------------------------------------------------
# Build datatoc_icon executable

if(NOT WITH_HEADLESS)

  set(SRC
    datatoc_icon.c
  )
//ERROR seems to be at the line that says setup_playform_linker_flags(datatoc)
  setup_platform_linker_flags(datatoc)
  if(WIN32)
    include_directories(
      ../blenlib
      ../../../intern/utfconv
    )

    # for winstuff_dir.c
    add_definitions(-DUSE_STANDALONE)

    list(APPEND SRC
      ../blenlib/intern/winstuff_dir.c
      ../../../intern/utfconv/utfconv.c
    )

  endif()

  include_directories(${PNG_INCLUDE_DIRS})

  add_executable(datatoc_icon ${SRC})
  setup_platform_linker_flags(datatoc_icon)

  target_link_libraries(datatoc_icon ${PNG_LIBRARIES} ${ZLIB_LIBRARIES})
  # PNG library uses pow() and floow(), so seems -lm is required for proper
  # working binary.
  if(UNIX AND NOT APPLE)
    target_link_libraries(datatoc_icon m)
  endif()
endif()```

That’s defined in macros.cmake Visual studio should not be giving you CMake errors/warns in that dialog if you followed our build instructions.

I’d try to get a build going with make.bat following our instructions first, then play with the IDE

1 Like