Skip to content

[ncurses] Feature for --enable-widec #39939

Open

Description

Hello,
I was looking around ncurses port and I didn't find a way to enable widec.

In https://github.com/Kitware/CMake/blob/master/Modules/FindCurses.cmake there's a flag that makes this switch possible:

# we don't know anything about cursesw, so only ncurses
# may be ncursesw
if(NOT CURSES_NEED_WIDE)
  set(NCURSES_LIBRARY_NAME "ncurses")
  set(CURSES_FORM_LIBRARY_NAME "form")
else()
  set(NCURSES_LIBRARY_NAME "ncursesw")
  set(CURSES_FORM_LIBRARY_NAME "formw")
  # Also, if we are searching for wide curses - we are actually searching
  # for ncurses, we don't know about any other unicode version.
  set(CURSES_NEED_NCURSES TRUE)
endif()

In ncurses port there's an area where such options are set:

vcpkg_configure_make(
    SOURCE_PATH "${SOURCE_PATH}"
    DETERMINE_BUILD_TRIPLET
    NO_ADDITIONAL_PATHS
    OPTIONS
        ${OPTIONS}
        --disable-db-install
        --enable-pc-files
        --without-ada
        --without-debug # "lib model"
        --without-manpages
        --without-progs
        --without-tack
        --without-tests
        --with-pkg-config-libdir=libdir
)

But using vcpkg dependencies from a JSON file:

set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/MY_PROJECT/vcpkg/scripts/buildsystems/vcpkg.cmake"
  CACHE STRING "Vcpkg toolchain file")

I believe that the library is built before any CMake flags are taken into consideration:

    set(CURSES_NEED_WIDE TRUE)
    set(CURSES_NEED_NCURSES TRUE)

Because of the vcpkg JSON dependency file.

Is there a way to create a feature that can switch between these two? If there's any prior example or with an explanation I'm willing to do a PR as well.

Thank you!

Proposed solution

Switch for --enable-widec as a port feature.

Something similar I've seen here:
https://github.com/microsoft/vcpkg/blob/master/ports/libzip/vcpkg.json
With the following port file: https://github.com/microsoft/vcpkg/blob/master/ports/libzip/portfile.cmake.

If this is something acceptable I can try making a PR.

Describe alternatives you've considered

No response

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

category:port-featureThe issue is with a library, which is requesting new capabilities that didn’t exist

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions