Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface CMakeToolsAPI

The CMake Tools extension API obtained via getExtension().exports

Hierarchy

  • Disposable
    • CMakeToolsAPI

Implemented by

Index

Constructors

constructor

  • Creates a new Disposable calling the provided function on dispose.

    Parameters

    • callOnDispose: Function

      Function that disposes something.

    Returns CMakeToolsAPI

Properties

binaryDir

binaryDir: Thenable<string>

The root build directory for the project. May change based on build configuration.

cachePath

cachePath: Thenable<string>

The path to the `CMakeCache.txt for the project.

executableTargets

executableTargets: Thenable<ExecutableTarget[]>

List of CMake targets created via add_executable().

mainListFile

mainListFile: Thenable<string>

The CMakeLists.txt at to the root of the project

reconfigured

reconfigured: Event<void>

Event fired when the configure/generate stage completes

sourceDir

sourceDir: Thenable<string>

The source directory, containing the root of the project

targetChangedEvent

targetChangedEvent: Event<void>

Event fired when the active target changes.

targets

targets: Thenable<Target[]>

All targets available to be built

Methods

build

  • build(target?: undefined | string): Thenable<number>
  • Build the project

    Parameters

    • Optional target: undefined | string

      The target to build. If not provided, will build the user's active build target.

    Returns Thenable<number>

    the exit code of the build command

clean

  • clean(): Thenable<number>
  • Clean the build output. Runs the clean target.

    Returns Thenable<number>

    The exit code from the build command

cleanConfigure

  • cleanConfigure(): Thenable<number>
  • Clean up old configuration and reconfigure.

    note

    This is not the same as running clean, then configure. Cleaning up configure includes removing the CMake cache file and any intermediate configuration files.

    Returns Thenable<number>

    The exit code from CMake

cleanRebuild

  • cleanRebuild(): Thenable<number>
  • Clean the build output and rebuild

    Returns Thenable<number>

    The exit code from the build command.

configure

  • configure(extraArgs?: string[]): Thenable<number>
  • Configure the project.

    Parameters

    • Optional extraArgs: string[]

      Extra arguments to pass on the CMake command line

    Returns Thenable<number>

    The exit code of CMake

ctest

  • ctest(): Thenable<number>
  • Execute CTest

    Returns Thenable<number>

    The exit code from CTest

debugTarget

  • debugTarget(): Thenable<DebugSession | null>
  • Start the active target with a debugger.

    Returns Thenable<DebugSession | null>

dispose

  • dispose(): any
  • Dispose this object.

    Returns any

execute

  • Execute an arbitrary program.

    Parameters

    • program: string

      Path to an executable binary

    • args: string[]

      List of command-line arguments to the program

    • Optional options: ExecutionOptions

      Additional execution options

    Returns Thenable<ExecutionResult>

    The result of execution

    Why you should use this API:

    You can execute a program on your own, but if it requires access to environment variables that CMake Tools knows about, such as Visual C++ environment variables, this is the most reliable way to ensure that you execute in the context that the user is expecting.

executeCMakeCommand

  • Execute a command using the CMake executable.

    Parameters

    • args: string[]

      Arguments to CMake

    • Optional options: ExecutionOptions

      Additional execution options

    Returns Thenable<ExecutionResult>

    The result of execution.

install

  • install(): Thenable<number>
  • Installs the project

    Returns Thenable<number>

    The exit code from CMake

launchTarget

  • launchTarget(): Thenable<Terminal | null>
  • Start the active target without a debugger.

    Returns Thenable<Terminal | null>

launchTargetPath

  • launchTargetPath(): Thenable<string | null>
  • Get the path to the active launch target

    Returns Thenable<string | null>

stop

  • stop(): Thenable<boolean>
  • Stop the currently running command.

    Returns Thenable<boolean>

    true on success. false otherwise.

Static from

  • from(...disposableLikes: object[]): Disposable
  • Combine many disposable-likes into one. Use this method when having objects with a dispose function which are not instances of Disposable.

    Parameters

    • Rest ...disposableLikes: object[]

      Objects that have at least a dispose-function member.

    Returns Disposable

    Returns a new disposable which, upon dispose, will dispose all provided disposables.

Generated using TypeDoc