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

install(TARGETS ...) and favour-expansion #51

Closed
adamnagy90 opened this issue Jan 13, 2025 · 4 comments
Closed

install(TARGETS ...) and favour-expansion #51

adamnagy90 opened this issue Jan 13, 2025 · 4 comments

Comments

@adamnagy90
Copy link

Hi!
Similarly to #50, I'd like to ask about install(TARGETS while using favour-expansion (see respective help here).

With 0.18.0, I get the following formatting:

install(
    TARGETS
        ${LIB_NAME}
        COMPONENT
        TARGET_COMPONENT
        DESTINATION
        lib
)

My expectation would be either

install(
    TARGETS
        ${LIB_NAME}
    COMPONENT TARGET_COMPONENT
    DESTINATION lib
)

or

install(
    TARGETS
        ${LIB_NAME}
        COMPONENT TARGET_COMPONENT
        DESTINATION lib
)

if we assume the options to be subjects of the target. Personally I'd prefer the earlier.

Could you comment on this?

Thanks,
Adam

@BlankSpruce
Copy link
Owner

I'll see later today how I really think it should be dealt with but you are probably right because I've missed this part:

The first ... group applies to target Output Artifacts that do not have a dedicated group specified later in the same call.

@BlankSpruce
Copy link
Owner

If you're assuming very restrictive line_length (less than 70-ish) then your first expecation:

install(
    TARGETS
        ${LIB_NAME}
    COMPONENT TARGET_COMPONENT
    DESTINATION lib
)

is correct. However if line_length isn't as restrictive then the formatting would look like this:

install(TARGETS ${LIB_NAME} COMPONENT TARGET_COMPONENT DESTINATION lib)

because COMPONENT and DESTINATION aren't multi value keywords. Small deviations from that like more TARGETS or presence of multi value PERMISSIONS will expand that invocation:

install(
    TARGETS
        ${LIB_NAME}
        ${LIB2_NAME}
    COMPONENT TARGET_COMPONENT
    DESTINATION lib
)

install(
    TARGETS
        ${LIB_NAME}
    COMPONENT TARGET_COMPONENT
    DESTINATION lib
    PERMISSIONS
        foo
        bar
        baz
)

I'll release 0.18.1 probably by tomorrow with the fix.

@adamnagy90
Copy link
Author

adamnagy90 commented Jan 14, 2025

I actually have line_length set to 120 😅 but what you proposed looks good, thanks :)

@BlankSpruce
Copy link
Owner

Original expectation is quite understandable when you assume it's almost-not-a-bug.

0.18.1 just got released.

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