[cmake-developers] ncurses sub-dir and include path
Christoph Grüninger
foss at grueninger.de
Sun Jul 28 16:21:03 EDT 2019
Dear CMake developers,
for several years openSuse's CMake package has a patch which adds the
sub-directory ncurses to the CURSES_INCLUDE_PATH:
diff --git a/Source/CursesDialog/CMakeLists.txt
b/Source/CursesDialog/CMakeLists.txt
index 7d4e88c..0cc5357 100644
--- a/Source/CursesDialog/CMakeLists.txt
+++ b/Source/CursesDialog/CMakeLists.txt
@@ -17,7 +17,7 @@
CursesDialog/ccmake.cxx
)
-include_directories(${CURSES_INCLUDE_PATH})
+include_directories(${CURSES_INCLUDE_PATH}/ncurses/)
add_executable(ccmake ${CURSES_SRCS} )
The reason is, that curses.h and ncurses.h are present in /usr/include.
Both are symbolic links to /usr/include/ncurses/curses.h.
This layout does not seem uncommon, at least
CURSES_HAVE_NCURSES_NCURSES_H and
CURSES_HAVE_NCURSES_CURSES_H are true if the headers are found below
ncurses/.
I'd like to propose a patch for the issue with openSuse's package to
upstream CMake, but I figured out several ways to fix this issue. Can
you advice, which way you prefer?
1) Above patch.
2) Change the patch to add also the sub-directory ncurses/
-include_directories(${CURSES_INCLUDE_PATH})
+include_directories(${CURSES_INCLUDE_PATH};${CURSES_INCLUDE_PATH}/ncurses/)
3) Add the sub-diretory conditionally:
-include_directories(${CURSES_INCLUDE_PATH})
+if(CURSES_HAVE_NCURSES_NCURSES_H OR CURSES_HAVE_NCURSES_CURSES_H)
+ include_directories("${CURSES_INCLUDE_DIRS}/ncurses")
+else()
+ include_directories(${CURSES_INCLUDE_DIRS})
+endif()
4) Modify FincCurses.cmake that it adds ncurses to CURSES_INCLUDE_DIRS,
either conditionally or unconditionally. Use this variable instead of
CURSES_INCLUDE_PATH (which should be done anyway).
Which way should I follow and propose a merge request?
Kind regards,
Christoph
--
Nous vivons une époque où les pizzas arrivent plus vite que la police.
[Claude Chabrol]
More information about the cmake-developers
mailing list