BlankSpruce / gersemi

A formatter to make your CMake code the real treasure
Mozilla Public License 2.0
156 stars 8 forks source link

Possible Issues with FindPackageStandardArgs #1

Closed DeveloperPaul123 closed 4 years ago

DeveloperPaul123 commented 4 years ago

I gave this a try on a rather large project and I think I've found a small problem. Not sure if I'm misunderstanding what the format should look like, but I don't think the formatting of find_package_standard_args looks correct. Example output:

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
    Pylon
    REQUIRED_VARS
    PYLON_INCLUDE_DIR
    PYLON_BASE_LIBRARY
    PYLON_GC_BASE_LIBRARY
    PYLON_GENAPI_LIBRARY
    PYLON_UTILITY_LIBRARY
    # omitted for brevity
    FOUND_VAR
    PYLON_FOUND
    VERSION_VAR
    PYLON_VERSION
    FAIL_MESSAGE
    "Failed to find Pylon"
)

I would think something like this "should" be the output:

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
    Pylon
    REQUIRED_VARS
        PYLON_INCLUDE_DIR
        PYLON_BASE_LIBRARY
        PYLON_GC_BASE_LIBRARY
        PYLON_GENAPI_LIBRARY
        PYLON_UTILITY_LIBRARY
    # omitted for brevity
    FOUND_VAR PYLON_FOUND
    VERSION_VAR PYLON_VERSION
    FAIL_MESSAGE "Failed to find Pylon"
)

Is this an actual issue? Or do I need to point gersemi to the modules directory for my CMake installation (FindPackageStandardArgs is included with CMake).

BlankSpruce commented 4 years ago

Your understading for the style is correct however I'm not able to reproduce your case. Are you sure you haven't reduced the example too much? I suspect there might be some interaction with comments hence please double check your example.

Is this an actual issue? Or do I need to point gersemi to the modules directory for my CMake installation (FindPackageStandardArgs is included with CMake).

It sounds like an issue. Also cmake native modules aren't required to be pointed nor it would be useful in many cases.

BlankSpruce commented 4 years ago

I had a couple of minutes and I think I've found possible case you might have stumbled upon. For the record:

Input:

find_package_handle_standard_args(
    Pylon FOUND_VAR PYLON_FOUND
    # foobar
    REQUIRED_VARS PYLON_INCLUDE_DIR PYLON_BASE_LIBRARY PYLON_GC_BASE_LIBRARY PYLON_GENAPI_LIBRARY PYLON_UTILITY_LIBRARY
)

Output:

find_package_handle_standard_args(
    Pylon
    FOUND_VAR PYLON_FOUND
    # foobar
    REQUIRED_VARS
    PYLON_INCLUDE_DIR
    PYLON_BASE_LIBRARY
    PYLON_GC_BASE_LIBRARY
    PYLON_GENAPI_LIBRARY
    PYLON_UTILITY_LIBRARY
)

Expected:

find_package_handle_standard_args(
    Pylon
    FOUND_VAR PYLON_FOUND
    # foobar
    REQUIRED_VARS
        PYLON_INCLUDE_DIR
        PYLON_BASE_LIBRARY
        PYLON_GC_BASE_LIBRARY
        PYLON_GENAPI_LIBRARY
        PYLON_UTILITY_LIBRARY
)

Definitely a bug.

DeveloperPaul123 commented 4 years ago

Thanks for fixing this; will it be pushed to a new release soon?

BlankSpruce commented 4 years ago

Late response: it's already there in 0.4.0 release.