🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

cmake-js

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cmake-js

CMake.js - a Node.js native addon build tool

7.3.1
latest
Version published
Weekly downloads
162K
28.87%
Maintainers
2
Weekly downloads
 
Created

What is cmake-js?

The cmake-js npm package is a tool that simplifies the process of building native C++ addons for Node.js using CMake. It provides a seamless integration between Node.js and CMake, allowing developers to leverage the powerful build system of CMake while working within the Node.js ecosystem.

What are cmake-js's main functionalities?

Building Native Addons

This feature allows you to build native C++ addons for Node.js using CMake. The code sample demonstrates how to use cmake-js to build a target named 'myAddon' in debug mode.

const cmake = require('cmake-js');

cmake.build({
  target: 'myAddon',
  debug: true
}).then(() => {
  console.log('Build complete');
}).catch(err => {
  console.error('Build failed', err);
});

Configuring Build Options

This feature allows you to configure various build options for your CMake project. The code sample shows how to set the build type to 'Release' and specify an installation prefix.

const cmake = require('cmake-js');

cmake.configure({
  CMAKE_BUILD_TYPE: 'Release',
  CMAKE_INSTALL_PREFIX: '/usr/local'
}).then(() => {
  console.log('Configuration complete');
}).catch(err => {
  console.error('Configuration failed', err);
});

Running CMake Commands

This feature allows you to run arbitrary CMake commands. The code sample demonstrates how to run a CMake build command to install the target.

const cmake = require('cmake-js');

cmake.run(['--build', '.', '--target', 'install']).then(() => {
  console.log('CMake command executed successfully');
}).catch(err => {
  console.error('CMake command failed', err);
});

Other packages similar to cmake-js

FAQs

Package last updated on 17 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts