Mercurial > nsnake
changeset 4:705982af99f6
CMake: fix incorrect check of resizeterm and SIGWINCH
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 25 Feb 2016 13:50:01 +0100 |
parents | 68ecd9e8f379 |
children | 07f261a4ffbe |
files | CMakeLists.txt |
diffstat | 1 files changed, 22 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/CMakeLists.txt Thu Feb 25 12:36:05 2016 +0100 +++ b/CMakeLists.txt Thu Feb 25 13:50:01 2016 +0100 @@ -60,6 +60,25 @@ endif () # +# The curses library +# ------------------------------------------------------------------- +# +if (WIN32) + if (CMAKE_SIZEOF_VOID_P MATCHES 8) + set(ARCH amd64) + else () + set(ARCH x86) + endif () + + set(INCLUDES ${nsnake_SOURCE_DIR}/windows/${ARCH}/libpdcurses/include) + set(LIBS ${nsnake_SOURCE_DIR}/windows/${ARCH}/libpdcurses/lib/libpdcurses.a) +else () + find_package(Curses REQUIRED) + set(INCLUDES ${CURSES_INCLUDE_DIRS}) + set(LIBS ${CURSES_LIBRARIES}) +endif () + +# # Options. # ------------------------------------------------------------------- # @@ -78,6 +97,8 @@ # ------------------------------------------------------------------- # +set(CMAKE_REQUIRED_LIBRARIES ${LIBS}) + check_include_file(err.h HAVE_ERR_H) check_function_exists(err HAVE_ERR) @@ -86,7 +107,7 @@ check_function_exists(random HAVE_RANDOM) check_function_exists(srandom HAVE_SRANDOM) -check_symbol_exists(SIGWINCH curses.h HAVE_SIGWINCH) +check_symbol_exists(SIGWINCH signal.h HAVE_SIGWINCH) if (NOT HAVE_ERR_H OR NOT HAVE_ERRX) set(HAVE_ERR FALSE) @@ -130,26 +151,6 @@ add_executable(nsnake nsnake.c) -# -# For Windows, libpdcurses is bundled in nsnake, for other platforms, search for the curses library. -# -# We also install MinGW runtimes to the binary directory. -# -if (WIN32) - if (CMAKE_SIZEOF_VOID_P MATCHES 8) - set(ARCH amd64) - else () - set(ARCH x86) - endif () - - set(INCLUDES ${nsnake_SOURCE_DIR}/windows/${ARCH}/libpdcurses/include) - set(LIBS ${nsnake_SOURCE_DIR}/windows/${ARCH}/libpdcurses/lib/libpdcurses.a) -else () - find_package(Curses REQUIRED) - set(INCLUDES ${CURSES_INCLUDE_DIRS}) - set(LIBS ${CURSES_LIBRARIES}) -endif () - target_link_libraries(nsnake ${LIBS}) target_include_directories(nsnake PRIVATE ${INCLUDES} ${nsnake_BINARY_DIR})