Skip to content

Commit

Permalink
(#20355) ncurses: migrate to Conan v2
Browse files Browse the repository at this point in the history
* ncurses: migrate to Conan v2

* ncurses: fix Conan v1 compatibility

* ncurses: fix linter error

* ncurses: add "util" from libc as a system dependency

* ncurses: update MSVC version check

* ncurses: add libcxx to system_libs

To fix the 'undefined symbol: _ZNSt3__14cerrE' error when using the shared lib with libc++.

* ncurses: add automake dependency

* ncurses: remove -nologo

* ncurses: revert to not using ar-lib

* ncurses: remove -nologo

* ncurses: disable MSVC 193, fix -FS

* ncurses: link against naive-tsearch on MSVC

* ncurses: add AutotoolsDeps for MSVC dependencies

* ncurses: add AutotoolsDeps workaround

* ncurses: add -nologo

* ncurses: do not override the include dir path

* ncurses: drop test_v1_package

* ncurses: more reliable -FS

* ncurses: add /DEBUG:NONE

* ncurses: force -DEBUG:NONE

* ncurses: make sure CURSES_LIBRARIES contains absolute paths to match CMake

* ncurses: fix_apple_shared_install_name()

* ncurses: tidy

* ncurses: Revert "drop test_v1_package"

* ncurses: fix test_v1_package

* ncurses: fix exported CMake vars in Conan v1

* ncurses: drop test_v1_package

The legacy generators work ok on non-Windows single-config CMake setups, but not on MSVC.

* ncurses: set env var in generator

* ncurses: fix options handling

* ncurses: restore "auto" option values for clarity and backwards-compatibility

* ncurses: fix -FS not being applied on Conan v1
  • Loading branch information
valgur authored Dec 2, 2023
1 parent 2c0e6a2 commit e149e57
Show file tree
Hide file tree
Showing 4 changed files with 255 additions and 193 deletions.
36 changes: 36 additions & 0 deletions recipes/ncurses/all/cmake/conan-official-ncurses-targets.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Reproduces the variables set by https://cmake.org/cmake/help/latest/module/FindCurses.html
set(CURSES_FOUND ON)
set(CURSES_INCLUDE_DIRS ${Curses_INCLUDE_DIRS})
set(CURSES_CFLAGS ${Curses_DEFINITIONS} ${Curses_COMPILE_OPTIONS_C})
set(CURSES_HAVE_CURSES_H OFF)
set(CURSES_HAVE_NCURSES_H OFF)
if(CURSES_NEED_NCURSES)
set(CURSES_HAVE_NCURSES_CURSES_H ON)
set(CURSES_HAVE_NCURSES_NCURSES_H ON)
endif()

# For backward compatibility with Conan v1
string(TOUPPER "${CMAKE_BUILD_TYPE}" _CONFIG)
set(CURSES_INCLUDE_DIRS ${CURSES_INCLUDE_DIRS}
${ncurses_INCLUDE_DIRS_${_CONFIG}}
${Curses_INCLUDE_DIRS_${_CONFIG}}
)
set(CURSES_CFLAGS ${CURSES_CFLAGS}
${ncurses_DEFINITIONS_${_CONFIG}} ${ncurses_COMPILE_OPTIONS_C_${_CONFIG}}
${Curses_DEFINITIONS_${_CONFIG}} ${Curses_COMPILE_OPTIONS_C_${_CONFIG}}
)

# CURSES_LIBRARIES output from CMake uses absolute paths for the libraries
list (GET CURSES_INCLUDE_DIRS 0 _first_include_dir)
get_filename_component(CURSES_LIB_DIRS "${_first_include_dir}/../lib" ABSOLUTE)
foreach(_LIB ${Curses_LIBRARIES} ${ncurses_LIBRARIES_${_CONFIG}} ${Curses_LIBRARIES_${_CONFIG}})
if(TARGET ${_LIB} OR IS_ABSOLUTE ${_LIB})
list(APPEND CURSES_LIBRARIES ${_LIB})
else()
find_library(_LIB ${_LIB} PATHS ${CURSES_LIB_DIRS})
list(APPEND CURSES_LIBRARIES ${_LIB})
endif()
endforeach()

set(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_DIRS})
set(CURSES_LIBRARY ${CURSES_LIBRARIES})
Loading

0 comments on commit e149e57

Please sign in to comment.