cmake: Add proper detection of sys/mman.h. Fixes #450

Signed-off-by: Jerry Jacobs <jerry.jacobs@dualinventive.com>
pull/434/head
Jerry Jacobs 2016-08-03 11:04:20 +02:00
rodzic df1522b7db
commit 57cf59a869
2 zmienionych plików z 7 dodań i 1 usunięć

Wyświetl plik

@ -2,6 +2,7 @@ project(stlink C)
cmake_minimum_required(VERSION 2.8.7)
include(CheckCCompilerFlag)
include(CheckIncludeFile)
find_package(PkgConfig)
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_SOURCE_DIR}/cmake/modules")
@ -47,6 +48,11 @@ elseif()
add_cflag_if_supported("-O2")
endif()
CHECK_INCLUDE_FILE(sys/mman.h STLINK_HAVE_SYS_MMAN_H)
if (STLINK_HAVE_SYS_MMAN_H)
add_definitions(-DSTLINK_HAVE_SYS_MMAN_H)
endif()
set(STLINK_HEADERS
include/stlink.h
include/stlink/usb.h

Wyświetl plik

@ -1,7 +1,7 @@
#ifndef STLINK_MMAP_H
#define STLINK_MMAP_H
#ifdef HAVE_SYS_MMAN_H
#ifdef STLINK_HAVE_SYS_MMAN_H
#include <sys/mman.h>
#else