Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any utility that can reformat a cmake file

I have relatively complex cmake files and I am wondering if there is any utility that can reformat a cmakeList.txt and beautify it for easier reading?

Some simple tricks would do the jobs, such as indenting if else endif sections and so on.

Is there any such tools?

I am using notepad++ for editing, but if there is any other tools, I can switch.

like image 948
mans Avatar asked Jan 03 '17 15:01

mans


People also ask

What is CMake format?

A CMAKE file is a project file created by the open-source, cross-platform tool CMake. It contains source script in the CMake language for the entire program. CMake tool uses programming scripts, known as CMakeLists, to generate build files for a specific environment such as makefiles Unix machine.

What is glob CMake?

GLOB will generate a list of all files that match the globbing expressions and store it into the variable. Globbing expressions are similar to regular expressions, but much simpler. If RELATIVE flag is specified for an expression, the results will be returned as a relative path to the given path.

What is a CMake list file?

Last modified: 12 February 2022. CMakeLists. txt file contains a set of directives and instructions describing the project's source files and targets (executable, library, or both). When you create a new project, CLion generates CMakeLists. txt file automatically and places it in the project root directory.

How does CMake command work?

Cmake allows to provide cross platform build files that would generate platform specific project/make files for particular compilation/platform. cmake . inside your project's directory on Windows platform,Cmake will generate all the necessary project/solution files ( . sln etc.).


1 Answers

Someone recently wrote a CMake autoformatter called cmake_format. Still under development but should be good enough for basic CMake files.

like image 158
user3667089 Avatar answered Oct 19 '22 13:10

user3667089