From: Mikko Johannes Koivunalho Date: Sun, 8 Sep 2019 07:51:44 +0000 (+0200) Subject: Improve check_stdint.h creation in CMake X-Git-Tag: 0.13.0~6^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a77491a907dd421ca96f017eacb87394a34ff75d;p=check Improve check_stdint.h creation in CMake Will not convert m4/ax_create_stdint_h.m4 to CMake. Make the resulting check_stdint.h similar to the old one (as much as is possible). GNU Autotools build is untouched. It continues to use m4 macro and generates check_stdint.h from scratch. Signed-off-by: Mikko Johannes Koivunalho --- diff --git a/CMakeLists.txt b/CMakeLists.txt index f4b958f..0edfd00 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -362,6 +362,21 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/config.h.in include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) add_definitions(-DHAVE_CONFIG_H) set(CONFIG_HEADER ${CMAKE_CURRENT_BINARY_DIR}/config.h) + +############################################################################### +# Generate "check_stdint.h" from "cmake/check_stdint.h.in" +# +# The corresponding GNU Autotools build of this project +# has m4 macro `m4/ax_create_stdint_h.m4` to create +# the file `check_stdint.h` from scratch. +# Include file `stdint.h` was introduced in C99 ANSI standard but +# many compilers were lacking behind or still are and +# have not implemented C99 or their `stdint.h` is not compatible. +# Therefore the m4 macro was needed to create the required datatypes. +# +# When converting to CMake we also want to abandon the m4 macros. +# +set(PROJECT_VERSION "${check_VERSION}") configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/check_stdint.h.in ${CMAKE_CURRENT_BINARY_DIR}/check_stdint.h @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/check_stdint.h DESTINATION include) diff --git a/cmake/check_stdint.h.in b/cmake/check_stdint.h.in index ab467c1..13f284a 100644 --- a/cmake/check_stdint.h.in +++ b/cmake/check_stdint.h.in @@ -1,6 +1,41 @@ +/*-*- mode:C; -*- */ +/* + * Check: a unit test framework for C + * + * Copyright (C) 2013 Branden Archer + * Copyright (C) 2019 Mikko Johannes Koivunalho + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + #ifndef _CHECK_CHECK_STDINT_H #define _CHECK_CHECK_STDINT_H 1 +#ifndef _GENERATED_STDINT_H +#define _GENERATED_STDINT_H "@PROJECT_NAME@ @PROJECT_VERSION@" +/* generated using CMake @CMAKE_VERSION@ from file cmake/check_stdint.h.in */ + +/* Imported CMake variables created during build. */ +#cmakedefine HAVE_STDINT_H 1 + #ifdef HAVE_STDINT_H +#define _STDINT_HAVE_STDINT_H 1 #include -#endif -#endif +#undef HAVE_STDINT_H +#endif /* defined HAVE_STDINT_H */ + +/* Define only once */ +#endif /* _GENERATED_STDINT_H */ +#endif /* _CHECK_CHECK_STDINT_H */