Cmake configure for config.h.

pull/330/head
Lance Wallis 2 weeks ago
parent a5d1342d53
commit 5258657051
No known key found for this signature in database
GPG Key ID: AE7847735CE374E4
  1. 32
      CMakeLists.txt
  2. 42
      cmakeconfig.h.in

@ -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

@ -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…
Cancel
Save