mirror of
https://github.com/michaelrsweet/mxml.git
synced 2026-08-13 11:44:45 -04:00
Cmake configure for config.h.
This commit is contained in:
parent
a5d1342d53
commit
5258657051
@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.19) # First to support Apple Silicon.
|
||||
project(mxml C)
|
||||
project(mxml LANGUAGES C VERSION 4.0.4)
|
||||
enable_testing()
|
||||
|
||||
# Don't allow source tree pollution.
|
||||
@ -18,6 +18,36 @@ if(WIN32)
|
||||
)
|
||||
endif(WIN32)
|
||||
|
||||
# ==================== CONFIG.H ====================
|
||||
# For now this is not thorough, but enough to work for
|
||||
# the vast majority of cases.
|
||||
|
||||
include(CheckIncludeFile)
|
||||
include(CheckTypeSize)
|
||||
|
||||
set(MXML_VERSION ${CMAKE_PROJECT_VERSION})
|
||||
|
||||
if(SIZEOF_LONG_LONG EQUAL "8")
|
||||
option(HAVE_LONG_LONG_INT "Enable LONG LONG" ON)
|
||||
else()
|
||||
option(HAVE_LONG_LONG_INT "Enable LONG LONG" OFF)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
option(HAVE_PTHREAD_H "Disable PTHREAD for windows." OFF)
|
||||
else()
|
||||
option(HAVE_PTHREAD_H "Enable PTHREAD as it's probably available." ON)
|
||||
endif()
|
||||
|
||||
# For now assume inline on.
|
||||
option(inline "Enable inline function support." ON)
|
||||
|
||||
configure_file(cmakeconfig.h.in ${CMAKE_CURRENT_SOURCE_DIR}/config.h
|
||||
@ONLY
|
||||
)
|
||||
|
||||
# ==================== /CONFIG.H ====================
|
||||
|
||||
set(MXML_PRIVATE
|
||||
mxml-attr.c
|
||||
mxml-file.c
|
||||
|
||||
42
cmakeconfig.h.in
Normal file
42
cmakeconfig.h.in
Normal file
@ -0,0 +1,42 @@
|
||||
//
|
||||
// A CMake compatible version for config.h.in -> config.h
|
||||
//
|
||||
|
||||
#ifndef MXML_CONFIG_H
|
||||
# define MXML_CONFIG_H
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
# include <stdarg.h>
|
||||
# include <ctype.h>
|
||||
|
||||
|
||||
//
|
||||
// Version number
|
||||
//
|
||||
|
||||
#cmakedefine MXML_VERSION "@CMAKE_PROJECT_VERSION@"
|
||||
|
||||
|
||||
//
|
||||
// Inline function support
|
||||
//
|
||||
|
||||
#cmakedefine inline
|
||||
|
||||
|
||||
//
|
||||
// Long long support
|
||||
//
|
||||
|
||||
#cmakedefine01 HAVE_LONG_LONG_INT
|
||||
|
||||
|
||||
//
|
||||
// Have <pthread.h>?
|
||||
//
|
||||
|
||||
#cmakedefine01 HAVE_PTHREAD_H
|
||||
|
||||
|
||||
#endif // !MXML_CONFIG_H
|
||||
Loading…
Reference in New Issue
Block a user