]> granicus.if.org Git - check/commitdiff
Improve check_stdint.h creation in CMake
authorMikko Johannes Koivunalho <mikko.koivunalho@iki.fi>
Sun, 8 Sep 2019 07:51:44 +0000 (09:51 +0200)
committerMikko Johannes Koivunalho <mikko.koivunalho@iki.fi>
Sun, 8 Sep 2019 17:50:34 +0000 (19:50 +0200)
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 <mikko.koivunalho@iki.fi>
CMakeLists.txt
cmake/check_stdint.h.in

index f4b958fa06101e495b4eb46ccc2987222e467a7c..0edfd0068d00274658ed53e20fb555799f108493 100644 (file)
@@ -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)
index ab467c1f81906318236b32d100792fae5d05441e..13f284a9a0f3f6dd2182ea0e53e37346d372a551 100644 (file)
@@ -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 <stdint.h>
-#endif
-#endif
+#undef HAVE_STDINT_H
+#endif /* defined HAVE_STDINT_H */
+
+/* Define only once */
+#endif /* _GENERATED_STDINT_H */
+#endif /* _CHECK_CHECK_STDINT_H */