{"id":19879624,"url":"https://github.com/mathisloge/cmake-napi","last_synced_at":"2026-05-17T02:05:24.763Z","repository":{"id":143767900,"uuid":"429793223","full_name":"mathisloge/cmake-napi","owner":"mathisloge","description":null,"archived":false,"fork":false,"pushed_at":"2022-01-19T09:31:21.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-27T20:49:41.557Z","etag":null,"topics":["cmake","cpp","napi","node","nodejs"],"latest_commit_sha":null,"homepage":"","language":"CMake","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mathisloge.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-19T12:40:55.000Z","updated_at":"2021-11-20T11:39:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"14ead4e8-1463-4a86-a5a0-92edeb42fcba","html_url":"https://github.com/mathisloge/cmake-napi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mathisloge/cmake-napi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathisloge%2Fcmake-napi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathisloge%2Fcmake-napi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathisloge%2Fcmake-napi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathisloge%2Fcmake-napi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mathisloge","download_url":"https://codeload.github.com/mathisloge/cmake-napi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathisloge%2Fcmake-napi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33125184,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-16T18:38:32.183Z","status":"online","status_checked_at":"2026-05-17T02:00:05.366Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cmake","cpp","napi","node","nodejs"],"created_at":"2024-11-12T17:08:59.986Z","updated_at":"2026-05-17T02:05:24.746Z","avatar_url":"https://github.com/mathisloge.png","language":"CMake","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CMake for N-API \n\n## usage\n\n```cmake\ninclude(FetchContent)\nFetchContent_Declare(\n  napi\n  GIT_REPOSITORY https://github.com/mathisloge/cmake-napi.git\n  GIT_TAG        \u003ccurrent_hash\u003e\n)\nFetchContent_MakeAvailable(napi)\n\nadd_library(mynodelib MODULE)\n\ntarget_link_libraries(mynodelib PRIVATE node::napi)\n```\n\n## usage with node-pre-gyp\n\n\nInside your `CMakeLists.txt`: \n```cmake\ninclude(FetchContent)\n\nFetchContent_Declare(\n  napi_modules\n  GIT_REPOSITORY https://github.com/mathisloge/cmake-napi.git\n  GIT_TAG        \u003ctag\u003e\n)\nFetchContent_MakeAvailable(napi_modules)\nFetchContent_GetProperties(napi_modules SOURCE_DIR napi_src)\nlist(APPEND CMAKE_MODULE_PATH \"${napi_src}/modules\")\ninclude(napi-gyp)\n\n\nadd_library(mynodelib MODULE)\ntarget_link_libraries(mynodelib PRIVATE node::napi)\n```\n\n\nYour `binding.gyp`:\n\n```\n{\n    'targets': [\n        {\n        'target_name': 'build-mytarget',\n        'type': 'none',\n        'actions': [\n            {\n                'action_name': 'configure',\n                'message': 'configuring \u003ctarget\u003e...',\n                'inputs': [],\n                'outputs': [\"build/CMakeCache.txt\"],\n                'action': ['cmake', '.', '-B', 'build', '-DCMAKE_BUILD_TYPE=Release', '-DNAPI_VERSION=\u003c(napi_build_version)', '-Dnode_root_dir=\u003c(node_root_dir)', '-Dnode_lib_file=\u003c(node_lib_file)'],\n            },\n            {\n                'action_name': 'build',\n                'message': 'Building \u003ctarget\u003e...',\n                'inputs': [],\n                'outputs': [\"\u003c(module_path)/\u003cnode-module\u003e\"],\n                'action': ['cmake','--build', 'build', '--config Release'],\n            },\n        ]\n        }\n    ]\n}\n\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathisloge%2Fcmake-napi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmathisloge%2Fcmake-napi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathisloge%2Fcmake-napi/lists"}