Search code examples
c++apicmakesdkmaya

project (PROJECT) called with incorrect number of arguments [CMake] [MAYA 2020]


as you can see my CMakeLists.txt content is : I should add this that my MAYA version is 2020 but my devkit is 2020 hotfix 1 could it be the problem?

I don't know why the Autodesk documentation or other companies are not complete. they just explain things generally not in detail

cmake_minimum_required(VERSION 2.8)
project()

set(PROJECT_NAME test)


include($ENV{DEVKIT_LOCATION}/cmake/pluginEntry.cmake)



set(RESOURCES_FILES myResource.xpm)

set(MEL_FILES 
    test.mel)

set(SOURCE_FILES
        test.cpp
        ${MEL_FILES}
    )

set(LIBRARIES
    OpenMaya Foundation
    )

build_plugin()

when I wanna generate in CMake I get these Errors:

CMake Error at CMakeLists.txt:2 (project):
  project PROJECT called with incorrect number of arguments


    CMake Warning (dev) at M:/Autodesk_Maya_2020_DEVKIT_Windows_Hotfix_1/devkitBase/cmake/pluginEntry.cmake:204 (add_library):
      ADD_LIBRARY called with SHARED option but the target platform does not
      support dynamic linking.  Building a STATIC library instead.  This may lead
      to problems.
    Call Stack (most recent call first):
      CMakeLists.txt:25 (build_plugin)
    This warning is for project developers.  Use -Wno-dev to suppress it.

    CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
    Missing variable is:
    CMAKE_FIND_LIBRARY_PREFIXES
    CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
    Missing variable is:
    CMAKE_FIND_LIBRARY_SUFFIXES
    CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
    Missing variable is:
    CMAKE_FIND_LIBRARY_PREFIXES
    CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
    Missing variable is:
    CMAKE_FIND_LIBRARY_SUFFIXES
    CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
    Please set them or make sure they are set and tested correctly in the CMake files:
    Foundation_PATH
        linked by target "test" in directory C:/Users/amink/Desktop/API Project
    OpenMaya_PATH
        linked by target "test" in directory C:/Users/amink/Desktop/API Project

Solution

  • project() shouldn't be empty project(test) solved my problem

     cmake_minimum_required(VERSION 2.8)
        project(test)
    
        set(PROJECT_NAME test)
    
    
        include($ENV{DEVKIT_LOCATION}/cmake/pluginEntry.cmake)
    
    
    
        set(RESOURCES_FILES myResource.xpm)
    
        set(MEL_FILES 
            test.mel)
    
        set(SOURCE_FILES
                test.cpp
                ${MEL_FILES}
            )
    
        set(LIBRARIES
            OpenMaya Foundation
            )
    
        build_plugin()