{"id":18840195,"url":"https://github.com/fortran-lang/stdlib-cmake-example","last_synced_at":"2026-01-27T14:02:40.522Z","repository":{"id":47151178,"uuid":"325321237","full_name":"fortran-lang/stdlib-cmake-example","owner":"fortran-lang","description":"Integration of the Fortran standard library in CMake projects","archived":false,"fork":false,"pushed_at":"2021-09-11T08:10:11.000Z","size":17,"stargazers_count":17,"open_issues_count":1,"forks_count":5,"subscribers_count":13,"default_branch":"main","last_synced_at":"2026-01-13T02:30:06.778Z","etag":null,"topics":["cmake","fortran","stdlib"],"latest_commit_sha":null,"homepage":"","language":"Fortran","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/fortran-lang.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}},"created_at":"2020-12-29T15:26:58.000Z","updated_at":"2025-10-31T16:30:30.000Z","dependencies_parsed_at":"2022-09-24T05:02:01.315Z","dependency_job_id":null,"html_url":"https://github.com/fortran-lang/stdlib-cmake-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/fortran-lang/stdlib-cmake-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fortran-lang%2Fstdlib-cmake-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fortran-lang%2Fstdlib-cmake-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fortran-lang%2Fstdlib-cmake-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fortran-lang%2Fstdlib-cmake-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fortran-lang","download_url":"https://codeload.github.com/fortran-lang/stdlib-cmake-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fortran-lang%2Fstdlib-cmake-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28441004,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-15T00:55:22.719Z","status":"ssl_error","status_checked_at":"2026-01-15T00:55:20.945Z","response_time":107,"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":["cmake","fortran","stdlib"],"created_at":"2024-11-08T02:45:21.361Z","updated_at":"2026-01-27T14:02:40.492Z","avatar_url":"https://github.com/fortran-lang.png","language":"Fortran","readme":"\u003c!-- Remove this introduction after creating a new project from this template --\u003e\n# Using stdlib in your project\n\nThe Fortran standard library ([stdlib](https://github.com/fortran-lang/stdlib)) is developed by the [Fortran-lang community](https://github.com/fortran-lang).\nThis projects shows how to integrate stdlib in your CMake project.\n\nFor a quick start you can include stdlib as git submodule in your projects by\n\n```\ngit submodule https://github.com/fortran-lang/stdlib subprojects/stdlib\n```\n\nUsers must initialize the submodule themselves when building your project, unless you let CMake perform this operation on demand.\n\nAlternatively, you can use the `FetchContent` module of CMake to retrieve the git repository while configuring the project.\nA CMake snippet supporting both approaches is given here\n\n```cmake\n# Include the stdlib project\nif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/stdlib/CMakeLists.txt)\n  add_subdirectory(\"stdlib\")\nelse()\n  set(\"stdlib-url\" \"https://github.com/fortran-lang/stdlib\")\n  message(STATUS \"Retrieving stdlib from ${stdlib-url}\")\n  include(FetchContent)\n  FetchContent_Declare(\n    \"stdlib\"\n    GIT_REPOSITORY \"${stdlib-url}\"\n    GIT_TAG \"HEAD\"\n  )\n  FetchContent_MakeAvailable(\"stdlib\")\nendif()\n```\n\nA more elaborated CMake module for making stdlib available can be found [here](config/cmake/Findfortran_stdlib.cmake).\nThis module makes sure the ``fortran_stdlib::fortran_stdlib`` target is always generated regardless of how the stdlib is included in the project.\n\nYou can configure stdlib by setting the appropriate options before including the subproject.\nImportant options are\n\n- `BUILD_SHARED_LIBS` should be set to off if you want to link statically against stdlib\n- `CMAKE_MAXIMUM_RANK` determines the maximum rank of arrays supported in stdlib, the default value is 15.\n  To save compile time you can reduce this value to the maximum rank needed in your application.\n\nThis project offers a ready to use integration of stdlib for CMake, including an exported library and a binary application.\nAdditionally, some boilerplate text in the README is available below as well as a testing setup with GitHub actions for GCC.\nThe general CMake style should allow you to reuse most of the CMake build files *without* modification, just change the project name, add your source files and you are ready to go.\n\nYou can [just *use this template* to create new project](https://github.com/fortran-lang/stdlib-cmake-example/generate).\nRemove this introduction from the README afterwards and fill in your project details.\n\nFor more information on stdlib visit its [documentation](https://stdlib.fortran-lang.org).\n\n\n\u003c!-- Boilerplate README starting after this line --\u003e\n## Installation\n\nTo build this project you need\n\n- A Fortran compiler supporting Fortran 2008 or later (`gfortran` or `ifort`)\n- CMake version 3.14 or later\n- The [fypp](https://github.com/aradi/fypp) preprocessor\n- A build backend, ninja (version 1.10 or newer) or make\n\u003c!-- Add other prerequisites from your project to this list --\u003e\n\nConfigure the build with (set the `CMAKE_INSTALL_PREFIX` to your preferred install location)\n\n```\ncmake -B _build -G Ninja -DCMAKE_INSTALL_PREFIX=$HOME/.local\n```\n\nTo build the project run\n\n```\ncmake --build _build\n```\n\nFinally, you can install the project with\n\n```\ncmake --install _build\n```\n\n\n\u003c!-- Do not forget to update the LICENSE file with your name! --\u003e\n## License\n\nThis project is free software: you can redistribute it and/or modify it under the terms of the [MIT license](LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffortran-lang%2Fstdlib-cmake-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffortran-lang%2Fstdlib-cmake-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffortran-lang%2Fstdlib-cmake-example/lists"}