include: add non-conflicting generation and installation of config.h file

This commit is contained in:
Marc-André Moreau 2012-08-12 17:00:09 -04:00
parent ec1a17f554
commit 7e88cc23ee
3 changed files with 52 additions and 10 deletions

View File

@ -95,6 +95,12 @@ if(MSVC)
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR})
endif()
# config.h definitions for installable headers
check_include_files(limits.h FREERDP_HAVE_LIMITS_H)
check_include_files(stdint.h FREERDP_HAVE_STDINT_H)
check_include_files(stdbool.h FREERDP_HAVE_STDBOOL_H)
check_include_files(inttypes.h FREERDP_HAVE_INTTYPES_H)
# Include files
check_include_files(fcntl.h HAVE_FCNTL_H)
check_include_files(unistd.h HAVE_UNISTD_H)
@ -159,6 +165,7 @@ include_directories(${CMAKE_SOURCE_DIR}/include)
# Configure files
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/freerdp/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/freerdp/config.h)
# Generate pkg-config
if(NOT MSVC)

View File

@ -0,0 +1,36 @@
/**
* FreeRDP: A Remote Desktop Protocol Client
* config.h definitions for installable headers
*
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CONFIG_H
#define FREERDP_CONFIG_H
/*
* This generated config.h header is meant for installation, which is why
* all definitions MUST be prefixed to avoid conflicting with third-party
* libraries. Only add configurable definitions which really must be used
* from installable headers, such as the base type definition types.
*/
#cmakedefine FREERDP_HAVE_LIMITS_H
#cmakedefine FREERDP_HAVE_STDINT_H
#cmakedefine FREERDP_HAVE_STDBOOL_H
#cmakedefine FREERDP_HAVE_INTTYPES_H
#endif

View File

@ -18,25 +18,24 @@
* limitations under the License.
*/
#ifndef __RDP_TYPES_H
#define __RDP_TYPES_H
#ifndef FREERDP_TYPES_H
#define FREERDP_TYPES_H
#include <freerdp/config.h>
#ifdef _WIN32
#include <windef.h>
#endif
/* Base Types */
#include "config.h"
#ifdef HAVE_LIMITS_H
#ifdef FREERDP_HAVE_LIMITS_H
#include <limits.h>
#endif
#ifdef HAVE_STDINT_H
#ifdef FREERDP_HAVE_STDINT_H
#include <stdint.h>
#endif
#ifdef HAVE_INTTYPES_H
#ifdef FREERDP_HAVE_INTTYPES_H
#include <inttypes.h>
typedef uint8_t uint8;
@ -66,7 +65,7 @@ typedef signed long long sint64;
#endif /* HAVE_INTTYPES_H */
#ifdef HAVE_STDBOOL_H
#ifdef FREERDP_HAVE_STDBOOL_H
#include <stdbool.h>
@ -108,7 +107,7 @@ typedef int boolean;
#endif /* __cplusplus */
#endif /* HAVE_STDBOOL_H */
#endif /* FREERDP_HAVE_STDBOOL_H */
#ifndef MIN
#define MIN(x,y) (((x) < (y)) ? (x) : (y))