{"id":47929990,"url":"https://github.com/mdsanima-lab/cmake-demo","last_synced_at":"2026-04-04T07:15:10.523Z","repository":{"id":224190535,"uuid":"762667906","full_name":"mdsanima-lab/cmake-demo","owner":"mdsanima-lab","description":"Introduction to CMake configuration for building and running simple demo C/C++ programs.","archived":false,"fork":false,"pushed_at":"2026-02-23T20:40:44.000Z","size":127,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-24T03:01:45.691Z","etag":null,"topics":["build","clang","clanguage","cmake","cpp","hpp"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mdsanima-lab.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-02-24T11:03:39.000Z","updated_at":"2026-02-23T20:40:43.000Z","dependencies_parsed_at":"2024-02-29T19:25:24.806Z","dependency_job_id":"6d05d49c-d32a-4346-98bb-15f6faea05a4","html_url":"https://github.com/mdsanima-lab/cmake-demo","commit_stats":null,"previous_names":["mdsanima-lab/clang-demo","mdsanima-lab/cmake-demo"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/mdsanima-lab/cmake-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdsanima-lab%2Fcmake-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdsanima-lab%2Fcmake-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdsanima-lab%2Fcmake-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdsanima-lab%2Fcmake-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdsanima-lab","download_url":"https://codeload.github.com/mdsanima-lab/cmake-demo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdsanima-lab%2Fcmake-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31391083,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T04:26:24.776Z","status":"ssl_error","status_checked_at":"2026-04-04T04:23:34.147Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["build","clang","clanguage","cmake","cpp","hpp"],"created_at":"2026-04-04T07:15:07.476Z","updated_at":"2026-04-04T07:15:10.497Z","avatar_url":"https://github.com/mdsanima-lab.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CMake Demo\n\nIntroduction to [CMake](https://cmake.org/) configuration for building and running simple demo\n**C/C++** programs.\n\n\u003e [!NOTE]\n\u003e\n\u003e To build the sample _demo_ programs that are in the _example_ and _project_ directory, we are\n\u003e using `cmake` build system command on **WSL** or another virtual machine with a **GNU/Linux**\n\u003e system, such as **Debian**, **Ubuntu**, **Fedora**, **CentOS**, and so on. The choice is yours.\n\u003e Currently, we only support the _amd64_ and _arm64_ architecture.\n\nMake sure you have a program called **CMake** installed, as well as a compiler for the **C/C++**\nlanguages, typically by entering the following command in the terminal:\n\n```shell\nsudo apt update\nsudo apt install cmake gcc g++\ncmake --version\n```\n\nAlso you can install `clang-format` and `clang-tidy` for formatting the code and other cool stuff,\ntype the following command in the terminal:\n\n```shell\nsudo apt install clang-format clang-tidy\n```\n\nFirst step is a create build directory and generate the build files using `cmake` command from the\ntop-level project directory, type the following command:\n\n```shell\ncmake -B build\n```\n\nAfter running the above command, a `build` folder will be created, containing the necessary files to\nbuild the demo programs. These files are generated automatically based on the configuration in the\n`CMakeLists.txt` file.\n\nNavigate to the `build` directory and run the `make` command to build the executable files for the\ndemo programs:\n\n```shell\ncd build ; make\n```\n\nThe demo programs should be compiled, and now you can run the programs.\n\n\u003e [!CAUTION]\n\u003e\n\u003e For the build to succeed, you must copy the header file `mdsanima.h` into the `/usr/local/include`\n\u003e directory. This is because the `mdsanima.h` header file is a part of the **MDSANIMA** library,\n\u003e which is not a part of the **CMake** build system right now. To copy this file to the destination\n\u003e directory, type the following command in the terminal `sudo cp lib/mdsanima.h /usr/local/include`\n\u003e and then run the `make` command again.\n\nYou can now run the demo programs by typing the following command inside the `build` directory:\n\n```shell\n./mdsanima-amarooke\n./mdsanima-blizzard\n./mdsanima-conquest\n./mdsanima-fantastic\n./mdsanima-incredible\n./mdsanima-stunning\n```\n\nYou can also run the programs from the top-lever directory by simply adding the full path to the\nexecutable files like this `./build/mdsanima-fantastic` command.\n\n## Project Programs\n\nThe project programs are located in the `project` directory, and the executable files are located in\nthe `build` directory. After running the first command `cmake -B build` to generate the build files\nfor the _example_ and _project_ programs, and then running the `make` command to build the\nexecutable files, you can run the _example_ programs that we showed above.\n\nThe _mdsanima-amarooke_, _mdsanima-blizzard_ and _mdsanima-conquest_ program is quite different. You\ncan install the project program by typing the following command:\n\n```shell\ncd build\nsudo make install\n```\n\nThat command will install the _mdsanima-amarooke_, _mdsanima-blizzard_ and _mdsanima-conquest_\nproject demo programs in the `/usr/local/bin` directory, and you can run the program by typing the\nfollowing command:\n\n```shell\nmdsanima-amarooke\nmdsanima-blizzard\nmdsanima-conquest\n```\n\nNow you can run the program in any directory on your system. The `CMakeLists.txt` file contains\nconfiguration for the static library and install command for this project.\n\nThe installation command will also create the `mdsanima.h` file in the `/usr/local/include`\ndirectory and the `libmdsanima.a` file in the `/usr/local/lib` directory that you can use later in\nyour own project.\n\n## Example Programs\n\nThere are various ways to create a project, one of which is as I presented here. The source files\nare located in the `src` directory, but you can also put all the files in one directory; it all\ndepends on the project.\n\n\u003e [!NOTE]\n\u003e\n\u003e To manualy build the demo programs, you can use the `gcc` or `g++` command to compile and link the\n\u003e source code files.\n\nHere is a example instruction for compiling and linking the source code files, type the following\ncommand:\n\n```shell\ncd example/mdsanima-fantastic ; mkdir build\ng++ -o build/mdsanima-fantastic main.cc\n./build/mdsanima-fantastic\n```\n\nThis method is only recommended if you want to manually build the program.\n\n\u003e [!IMPORTANT]\n\u003e\n\u003e The sample projects are written in **C** and **C++** languages, and the source code files have\n\u003e extensions `.c`, `.cc`, and `.cpp`. You can also use the `.cxx` file format, as we added in the\n\u003e example project. Here is just an example. Remember to use the chosen format and be consistent with\n\u003e it.\n\nAll projects are the same; they only differ in the text displayed in the terminal and in other file\nextensions.\n\n## Google Style Guide\n\nAlso, check how _Google_ does it. Here is a\n[C++ Style Guide](https://google.github.io/styleguide/cppguide.html) and\n[Objective-C Style Guide](https://google.github.io/styleguide/objcguide.html) provided by the\n[Google Style Guide](https://github.com/google/styleguide). The complete guide for naming\nconventions, variables, functions, and more by _Google_.\n\nThis comprehensive guide includes code style conventions for **C/C++**, _Python_ or other languages,\ncovering variable names, function and file names, and more. It has been authored, revised, and\nmaintained by many Googlers.\n\nThis adjustment maintains clarity while enhancing the flow of information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdsanima-lab%2Fcmake-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdsanima-lab%2Fcmake-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdsanima-lab%2Fcmake-demo/lists"}