## generate cmdHelp.c
set(COMMENT "This file was generated by CMake out of cmdHelp.c.in. Do not modify it")

set(python_script_create_help "${PROJECT_SOURCE_DIR}/../scripts/create_help.py")


if(BUILD_CMD_HELP)
#if the BUILD_CMD_HELP option is ON substitute list of commands
  if(NOT PYTHONINTERP_FOUND)
        message(WARNING "Python not found, on-line help can't be built")
        set(command_number "0")
  else()
    set(commands_search_paths
      ${PROJECT_SOURCE_DIR}/code/nusmv/shell
      )
    execute_process(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/../scripts/
      COMMAND "${PYTHON_EXECUTABLE}" "${python_script_create_help}" -c -p ${commands_search_paths}
      OUTPUT_VARIABLE command_list
      )
    execute_process(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/../scripts/
      COMMAND "${PYTHON_EXECUTABLE}" "${python_script_create_help}" -n -p ${commands_search_paths}
      OUTPUT_VARIABLE command_number
      )
  endif()
else()
#if the BUILD_CMD_HELP is OFF set number of command at 0
     set(command_number "0")
endif()

configure_file(cmdHelp.c.in ${CMAKE_CURRENT_BINARY_DIR}/cmdHelp.c @ONLY)


##now I add the generated cmdHelp.c to the source list of file and add to project
#message(path of cmdHelp.c: ${CMAKE_CURRENT_BINARY_DIR}/cmdHelp.c)
set(SRCS
  cmd.c
  cmdCmd.c
  cmdFile.c
  cmdMisc.c
  ${CMAKE_CURRENT_BINARY_DIR}/cmdHelp.c
  )

nusmv_add_pkg_shell(${SRCS})

nusmv_add_pkg_headers(cmd.h cmdInt.h cmdCmd.h cmdCmdInt.h)
