Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to Enable auto format on file save using *.astylerc defined in project file for CMake based project



  • My goal is to have per-project auto formating.
    Enabling Beautifier in QtCreator with artistic style works in case .astylerc file is placed at home folder,
    but I am not able to force usage *.astylerc file in CMake based project.

    I tried to set DISTFILES variable in CMakeList.txt, but this seems has no effect and QtCreator complains that style definition file can't be found.

    Any help is appreciated.

    Best Regards,
    Alex



  • Answering my own question: after looking into qtcreator source code I realized that it is sufficient to add myoptions.astylerc file to the project similar to any source file.


Log in to reply