Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Conveniently provide active build types to port files #20250

Closed
dg0yt opened this issue Sep 19, 2021 · 3 comments
Closed

Conveniently provide active build types to port files #20250

dg0yt opened this issue Sep 19, 2021 · 3 comments
Assignees
Labels
category:vcpkg-feature The issue is a new capability of the tool that doesn’t already exist and we haven’t committed

Comments

@dg0yt
Copy link
Contributor

dg0yt commented Sep 19, 2021

Is your feature request related to a problem? Please describe.
To deal with the actually selected build types, port files and maintainer functions need to write:

if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
...
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
...
endif()

This is rather long for a common condition and easy to get wrong (DEFINED? Release?).
This is one of the barriers for properly supporting single-config triplets in portfiles.

Proposed solution
Provide a list variable with the active build types.

if("debug" IN_LIST VCPKG_ACTIVE_BUILD_TYPES)
...
endif()
if("release" IN_LIST VCPKG_ACTIVE_BUILD_TYPES)
...
endif()

Describe alternatives you've considered
VCPKG_BUILD_TYPES would be shorter but invites typos due to similarity with VCPKG_BUILD_TYPES.

Discrete boolean variables would allow even shorter conditions, and remove ambiguity about spelling/case:

if(VCPKG_BUILD_DEBUG)
...
endif()
if(VCPKG_BUILD_RELEASE)
...
endif()
@autoantwort
Copy link
Contributor

I strongly prefer VCPKG_BUILD_DEBUG and VCPKG_BUILD_RELEASE :)

@Neumann-A
Copy link
Contributor

related #7733

@dg0yt
Copy link
Contributor Author

dg0yt commented Sep 20, 2021

related #7733

That PR includes per-build-type properties which I also considered but didn't want to add to this specific issue. 👍

@PhoebeHui PhoebeHui self-assigned this Sep 22, 2021
@PhoebeHui PhoebeHui added the category:vcpkg-feature The issue is a new capability of the tool that doesn’t already exist and we haven’t committed label Sep 22, 2021
@microsoft microsoft locked and limited conversation to collaborators Jun 22, 2022
@PhoebeHui PhoebeHui converted this issue into discussion #25384 Jun 22, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
category:vcpkg-feature The issue is a new capability of the tool that doesn’t already exist and we haven’t committed
Projects
None yet
Development

No branches or pull requests

4 participants