Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No custom formatter for exec_program() #7

Closed
adriaandegroot opened this issue Dec 17, 2021 · 3 comments
Closed

No custom formatter for exec_program() #7

adriaandegroot opened this issue Dec 17, 2021 · 3 comments

Comments

@adriaandegroot
Copy link

There is no custom formatter for exec_program(), so the arguments are not indented at all.

For instance, this input remains unchanged:

macro(GET_PROJECT_GIT_VERSION)
    find_package(Git QUIET)
    if(Git_FOUND)
        message(STATUS "Looking for git-versioning information.")
        exec_program(
            ${GIT_EXECUTABLE}
            ${CMAKE_CURRENT_SOURCE_DIR}
            ARGS
            describe
            --tags
            --match
            'v[0-9]*.*.*'
            --dirty
            OUTPUT_VARIABLE
            GIT_VERSION_INFO
            RETURN_VALUE
            GIT_ERROR
        )
    endif()
endmacro()

I would expect ARGS to be indented (muti-value option) and OUTPUT_VARIABLE and RETURN_VALUE to pull their single argument onto their own line.

@adriaandegroot
Copy link
Author

The exec_program() command has been deprecated since CMake 3.0 and is superceded by execute_process() which is correctly formatted. It's actually a good thing gersemi doesn't format it, it's a sign it should be replaced in the CMake code that is being formatted.

I'm filing this issue so that it can be closed as "not supporting deprecated methods" -- just in case people complain about it. Since there's a lot of _uninstall.cmake examples floating around that use exec_program(), it might come up occasionally.

@BlankSpruce
Copy link
Owner

With your finding it occurred to me now that I haven't specified anywhere that only CMake 3 is supported. I'll improve README about that since it's kind of significant detail. Thanks for letting me know.

@BlankSpruce BlankSpruce pinned this issue Dec 17, 2021
@BlankSpruce
Copy link
Owner

Here it is: 69bacb2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants