
Product
Socket for Jira Is Now Available
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.
node-cmake
Advanced tools
A CMake-based build system for Node.js native modules, for CMake >= v3.1.
Newly rewritten for 2.0!
node-gyp binarynode-gyp output and format. Should work better with tools that expect node-gyp's behaviourfind_package support. The module loading technique used in 1.0 was flawed for specific module structures and setup (deeply nested native dependencies). The new technique is to run ncmake update to copy the configuration script into your project. This means that projects will not stay in sync with updates automatically. Be sure to run ncmake update when updating node-cmake to a new version.ncmake command line arguments. ncmake now follows and extends the node-gyp command line interface. Please update your build files to use the new syntax (ncmake --build => ncmake rebuild). For more info, see the manual.To use this package, add the module node-cmake to your package.json as a development dependency:
npm install --save-dev node-cmake
Run ncmake update to copy the file NodeJS.cmake from this module into your project. Then add a CMakeLists.txt file to the root of your module that contains at least the following (<REPLACE> with your own definitions):
cmake_minimum_required(VERSION 3.1)
project(<NAME OF MODULE> VERSION 1.0.0)
include(NodeJS.cmake)
nodejs_init()
add_nodejs_module(${PROJECT_NAME} <SOURCE AND HEADER FILES GO HERE>)
This CMakeLists.txt file is the main build script for CMake, and replaces your existing binding.gyp file from node-gyp. It defines the build process for this project, including how to configure Node.js, and how to build your project components (modules, libraries, etc.)
The NodeJS.cmake file, included by relative path in this example, is a self-contained configuration tool for downloading the dependencies for building Node.js native modules, and configuring cmake to build them:
nodejs_init configures the version of Node.js to use for building. By default, this is the currently installed version of node on your platform. This function can take a number of advanced options (see Documentation). This function must be called before any other function provided by the script.
add_nodejs_module is a helper function for configuring CMake to build a node module based on the currently configured version of node. It takes the name of a target to create, along with a list of source files to build. All arguments after the target name are treated as sources.
CMake has extensive documentation online, which can be found here.
node-cmake has been updated to provide a drop-in replacement for node-gyp's interface. To build your module, use the command ncmake rebuild, which cleans, configures and builds the module.
This can be integrated into npm via its "scripts" directive:
"scripts": {
"install": "ncmake rebuild"
}
node-cmake also provides a simple javascript module to simplify the finding and loading of the built native module in your own scripts. It exposes a single function similar to require with the same effects. Calling
require('node-cmake')('<NAME OF MODULE>')
will load and return the named native module by searching in standard build locations. A second boolean can be passed to this function to configure loading of debug builds by default (if available).
An example project is provided in the example folder. Follow the directions in its README.md to build it correctly.
This tool was developed as a replacement for node-gyp, the current Node.js build system. Google has stopped working on its core, the gyp build tool, to focus on its replacement gn and the future of gyp is uncertain.
CMake also provides a number of benefits over gyp:
FAQs
A CMake-based build system for node.js native modules
The npm package node-cmake receives a total of 6,753 weekly downloads. As such, node-cmake popularity was classified as popular.
We found that node-cmake demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.