{"id":16603221,"url":"https://github.com/laserpants/foomake","last_synced_at":"2025-08-09T06:20:03.213Z","repository":{"id":148169634,"uuid":"162605836","full_name":"laserpants/foomake","owner":"laserpants","description":"Because modern CMake is declarative","archived":false,"fork":false,"pushed_at":"2018-12-27T13:13:01.000Z","size":157,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-29T04:25:17.951Z","etag":null,"topics":["cmake","cmakelists","declarative","format","json","using","yaml"],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/laserpants.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2018-12-20T16:39:58.000Z","updated_at":"2023-05-16T21:58:08.000Z","dependencies_parsed_at":"2023-05-19T08:45:29.290Z","dependency_job_id":null,"html_url":"https://github.com/laserpants/foomake","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laserpants%2Ffoomake","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laserpants%2Ffoomake/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laserpants%2Ffoomake/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laserpants%2Ffoomake/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/laserpants","download_url":"https://codeload.github.com/laserpants/foomake/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249187053,"owners_count":21226844,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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","cmakelists","declarative","format","json","using","yaml"],"created_at":"2024-10-12T00:48:26.697Z","updated_at":"2025-04-16T02:51:28.550Z","avatar_url":"https://github.com/laserpants.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# foomake\n\nWouldn't it be nice to have a more grokkable way to express CMake build requirements? So that, instead of\u0026hellip;\n\n```cmake\n# CMakeLists.txt\n\ncmake_minimum_required(VERSION 3.2)\n\nproject(example VERSION 0.1.0 LANGUAGES CXX)\n\nset(DEFAULT_BUILD_TYPE \"Release\")\n\nadd_library(grok STATIC src/laserpants/grok.cpp)\n\ntarget_include_directories(grok PUBLIC \"${CMAKE_CURRENT_SOURCE_DIR}/include\")\ntarget_compile_features(grok PUBLIC cxx_std_17)\n\nadd_executable(main src/main.cpp)\n\ntarget_link_libraries(main grok)\n```\n\n\u0026hellip;we could write something like:\n\n```yaml\nname:                   example\nversion:                0.1.0\ndescription:            An example of a declarative CMakeLists configuration\nhomepage:               http://github.com/laserpants/foomake#readme\nlanguages:              CXX\nvariables:\n  DEFAULT_BUILD_TYPE:   Release\n\nexecutables:\n  main:\n    source-files:\n      - src/main.cpp\n    link-libraries:\n      - grok\n\nlibraries:\n  grok:\n    type: static\n    source-files:\n      - src/laserpants/grok.cpp\n    include-directories:\n      public:\n        - '${CMAKE_CURRENT_SOURCE_DIR}/include'\n    compile-features:\n      public:\n        - cxx_std_17\n```\n\n## Top-level keys\n\n| Key                     | Type                     | Description                                     |\n|-------------------------|--------------------------|-------------------------------------------------|\n| name\u003csup\u003e\u0026dagger;\u003c/sup\u003e | string                   | Set the `PROJECT_NAME` variable                 |\n| version                 | string                   | Set the `PROJECT_VERSION` variable              |\n| description             | string                   | Set the `CMAKE_PROJECT_DESCRIPTION` variable    |\n| homepage                | string                   | Set the `CMAKE_PROJECT_HOMEPAGE_URL` variable   |\n| languages               | list (or string)         | Set the project `LANGUAGES`                     |\n| cmake-minimum-required  | dict (or string)         | Set the minimum required version of CMake       |\n| executables             | dict                     | Executable targets (binaries)                   |\n| libraries               | dict                     | Library targets                                 |\n| variables               | dict                     |                                                 |\n| options                 | dict                     |                                                 |\n| install                 | dict                     |                                                 |\n| configure               | list                     | Copy and perform variable substitution on files |\n| dependencies            | list                     |                                                 |\n\n\u0026dagger;) Required if any of `version`, `description`, `homepage`, or `languages` are set.\n\n---\n\n### `name`, `version`, `description`, `homepage`\n\nThese properties set the project details. For example,\n\n```yaml\nname: Your project\nversion: '1.3'\ndescription: One project to rule them all\n```\n\ntranslates to:\n\n```cmake\nproject(Your project\n  VERSION\n    1.3\n  DESCRIPTION\n    One project to rule them all\n  )\n```\n\nSurround the `version` string in single or double quoutes to avoid the value being interpreted as a number.\n\n---\n\n### `languages`\n\nA list of languages that your project supports. For example,\n\n```yaml\nname: example\nlanguages:\n  - CXX\n  - Fortran\n```\n\ntranslates to:\n\n```cmake\nproject(example LANGUAGES CXX Fortran)\n```\n\nA string can also be used: \n\n```yaml\nlanguages: CXX\n```\n\n---\n\n### `cmake-minimum-required`\n\n```yaml\ncmake-minimum-required:\n  version: '3.2'\n```\n\nThe following form is also accepted:\n\n```yaml\ncmake-minimum-required: '3.2'\n```\n\nOr to specify a range:\n\n```yaml\ncmake-minimum-required: '3.1...3.13'\n```\n\n---\n\n### `executables`\n\n```yaml\nexecutables:\n  \u003ctarget-name\u003e: \u003cdictionary\u003e\n  \u003ctarget-name\u003e: \u003cdictionary\u003e\n  ...\n```\n\nSee [Targets](#Targets)\n\n---\n\n### `libraries`\n\n```yaml\nlibraries:\n  \u003ctarget-name\u003e: \u003cdictionary\u003e\n  \u003ctarget-name\u003e: \u003cdictionary\u003e\n  ...\n```\n\nSee [Targets](#Targets)\n\n---\n\n### `variables`\n\nA dictionary where each key corresponds to the name of a variable.\n\n```yaml\nvariables:\n  \u003cvariable-name\u003e: \u003cvalue\u003e\n  \u003cvariable-name\u003e: \u003cvalue\u003e\n  ...\n```\n\nThe values are either strings (the variable's value), or objects of the following form:\n\n| Key          | Type                               | Required | Description                                   |\n|--------------|------------------------------------|----------|-----------------------------------------------|\n| value        | string                             | yes      |                                               |\n| TODO         |                                    |          |                                               |\n\n```yaml\nvariables:\n  MY_VARIABLE: rocks\n```\n\n```cmake\nset(MY_VARIABLE \"rocks\")\n```\n\n```yaml\nvariables:\n  MY_VARIABLE:\n    value: rocks\n```\n\n---\n\n### `options`\n\n```yaml\noptions:\n  \u003coption-name\u003e: \u003cdictionary\u003e\n  \u003coption-name\u003e: \u003cdictionary\u003e\n  ...\n```\n\n| Key            | Type                               | Required | Description                                   |\n|----------------|------------------------------------|----------|-----------------------------------------------|\n| description    | string                             |          |                                               |\n| initial-value  | string                             |          |                                               |\n\n```yaml\noptions:\n  DISCO_PANTS:\n    description: Whether to clothe oneself in disco attire or not\n    initial-value: 'YES'\n```\n\n---\n\n### `install`\n\n---\n\n### `configure`\n\nA list of files to perform variable substitution on. List entries should be dictionaries of the following form:\n\n| Key                  | Type                     | Required | Description                                        |\n|----------------------|--------------------------|:--------:|----------------------------------------------------|\n| file                 | list                     | yes      | A two-element list of the form [ input, output ]   |\n| arguments            | dict                     |          | Arguments accepted by the `configure_file` command |\n\nExample:\n\n```yaml\nconfigure:\n  - file: ['config.h.in', 'config.h']\n    arguments:\n      @ONLY: true\n```\n\n### `file`\n\n### `arguments`\n\n---\n\n## Targets\n\nTargets are specified under the `executables`, and `libraries` top-level keys respectively. \n\n```yaml\n  executables:\n    \u003ctarget-name\u003e: \u003cdictionary\u003e\n    \u003ctarget-name\u003e: \u003cdictionary\u003e\n    ...\n\n  libraries:\n    \u003ctarget-name\u003e: \u003cdictionary\u003e\n    \u003ctarget-name\u003e: \u003cdictionary\u003e\n    ...\n```\n\nThe following keys appear in mappings of both types.\n\n| Key                  | Type                               | Required | Default | Alias        | Description                                   |\n|----------------------|------------------------------------|:--------:|---------|--------------|-----------------------------------------------|\n| source-files         | list                               |          |         |              |                                               |\n| include-directories  | dict or list                       |          | []      | include-dirs |                                               |\n| link-libraries       | list                               |          |         | link-libs    |                                               |\n| compile-features     | dict                               |          |         |              |                                               |\n\n### `include-directories`\n\n```yaml\n    include-directories:\n      public:\n        - 'include'\n        - 'include/stuff'\n```\n\n```yaml\n    include-directories:\n      - 'include'\n      - 'include/stuff'\n```\n\n```yaml\n    include-directories:\n      public:\n        - path: 'include'\n      private:\n        - path: 'include/stuff'\n```\n\n---\n\n### `link-libraries`\n\n---\n\n### `source-files`\n\n---\n\n### Executables\n\n| Key                  | Type                     | Required | Default | Alias        | Description                                    |\n|----------------------|--------------------------|:--------:|---------|--------------|------------------------------------------------|\n\n---\n\n### Libraries\n\n| Key                  | Type                               | Required | Default | Alias        | Description                                   |\n|----------------------|------------------------------------|:--------:|---------|--------------|-----------------------------------------------|\n| type                 | static \u0026vert; shared \u0026vert; module |          | static  |              |                                               |\n---\n\n### `type`\n\n---\n\n## Dependencies\n\n```yaml\nname: example\nfind-package: \n  - name: Boost\n    version: '1.55'\n    components: 'asio'\n\nexecutables:\n  main:\n    link-libraries:\n      - Boost::boost\n```\n\n```yaml\nname: example\nfind-package: \n  - Boost\n```\n\n\n## Examples\n\nThe following examples are adapted from https://cmake.org/cmake-tutorial/\n\n### Step 1\n\n```cmake\ncmake_minimum_required (VERSION 2.6)\nproject (Tutorial)\n\n# the version number\nset (Tutorial_VERSION_MAJOR 1)\nset (Tutorial_VERSION_MINOR 0)\n\n# configure a header file to pass some of the CMake settings to the source code\nconfigure_file (\n  \"${PROJECT_SOURCE_DIR}/TutorialConfig.h.in\"\n  \"${PROJECT_BINARY_DIR}/TutorialConfig.h\"\n  )\n\n# add the binary tree to the search path for include files so that we will find TutorialConfig.h\ninclude_directories(\"${PROJECT_BINARY_DIR}\")\n\n# add the executable\nadd_executable(Tutorial tutorial.cxx)\n```\n\n```yaml\nname: Tutorial\nversion: '1.0'                      # the version number\n\ncmake-minimum-required:\n  version: '2.6'\n\nexecutables:\n  Tutorial:                         # add the executable\n    source-files:\n      - tutorial.cxx\n    include-directories:\n      public:\n        - '${PROJECT_BINARY_DIR}'   # add the binary tree to the search path for include files\n                                    # so that we will find TutorialConfig.h\n\n# configure a header file to pass some of the CMake settings to the source code\nconfigure:\n  - file: ['${PROJECT_SOURCE_DIR}/TutorialConfig.h.in',\n           '${PROJECT_BINARY_DIR}/TutorialConfig.h']\n```\n\n### Step 2\n\n```cmake\n# CMakeLists.txt\n\ncmake_minimum_required (VERSION 2.6)\nproject (Tutorial)\n\n# the version number\nset (Tutorial_VERSION_MAJOR 1)\nset (Tutorial_VERSION_MINOR 0)\n\n# should we use our own math functions\noption(USE_MYMATH \"Use tutorial provided math implementation\" ON)\n\n# configure a header file to pass some of the CMake settings to the source code\nconfigure_file (\n  \"${PROJECT_SOURCE_DIR}/TutorialConfig.h.in\"\n  \"${PROJECT_BINARY_DIR}/TutorialConfig.h\"\n  )\n\n# add the binary tree to the search path for include files so that we will find TutorialConfig.h\ninclude_directories (\"${PROJECT_BINARY_DIR}\")\n\n# add the MathFunctions library?\nif (USE_MYMATH)\n  include_directories (\"${PROJECT_SOURCE_DIR}/MathFunctions\")\n  add_subdirectory (MathFunctions)\n  set (EXTRA_LIBS ${EXTRA_LIBS} MathFunctions)\nendif ()\n\n# add the executable\nadd_executable (Tutorial tutorial.cxx)\ntarget_link_libraries (Tutorial  ${EXTRA_LIBS})\n```\n\n```cmake\n# MathFunctions/CMakeLists.txt\n\nadd_library(MathFunctions mysqrt.cxx)\n```\n\n\n```yaml\nname: Tutorial\nversion: '1.0'\n\ncmake-minimum-required:\n  version: '2.6'\n\noptions:\n  USE_MYMATH:\n    description: Use tutorial provided math implementation\n    initial-value: 'ON'\n\nexecutables:\n  Tutorial:\n    source-files:\n      - tutorial.cxx\n    include-directories:\n      public:\n        - '${PROJECT_BINARY_DIR}'\n    .if-USE_MYMATH-link-libraries:\n      - MathFunctions\n\nlibraries:\n  .if-USE_MYMATH-MathFunctions:\n    source-files:\n      - MathFunctions/mysqrt.cxx\n    include-directories:\n      public:\n        - '${PROJECT_SOURCE_DIR}/MathFunctions'\n\nconfigure:\n  - file: ['${PROJECT_SOURCE_DIR}/TutorialConfig.h.in',\n           '${PROJECT_BINARY_DIR}/TutorialConfig.h']\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaserpants%2Ffoomake","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flaserpants%2Ffoomake","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaserpants%2Ffoomake/lists"}