summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt8
-rw-r--r--src/cmark.h18
-rw-r--r--src/cmark_version.h.in7
3 files changed, 20 insertions, 13 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 254c065..a76ad0a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -47,6 +47,9 @@ set(PROGRAM_SOURCES
include_directories(. ${CMAKE_CURRENT_BINARY_DIR})
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmark_version.h.in
+ ${CMAKE_CURRENT_BINARY_DIR}/cmark_version.h)
+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libcmark.pc.in
${CMAKE_CURRENT_BINARY_DIR}/libcmark.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libcmark.pc
@@ -92,7 +95,10 @@ install(TARGETS ${PROGRAM} ${LIBRARY}
LIBRARY DESTINATION lib
)
-install(FILES cmark.h ${CMAKE_CURRENT_BINARY_DIR}/cmark_export.h
+install(FILES
+ cmark.h
+ ${CMAKE_CURRENT_BINARY_DIR}/cmark_export.h
+ ${CMAKE_CURRENT_BINARY_DIR}/cmark_version.h
DESTINATION include
)
diff --git a/src/cmark.h b/src/cmark.h
index faa5150..9f312bc 100644
--- a/src/cmark.h
+++ b/src/cmark.h
@@ -2,7 +2,8 @@
#define CMARK_H
#include <stdio.h>
-#include "cmark_export.h"
+#include <cmark_export.h>
+#include <cmark_version.h>
#ifdef __cplusplus
extern "C" {
@@ -499,8 +500,8 @@ char *cmark_render_man(cmark_node *root, long options);
* ## Version information
*/
-/** Macro containing the library version as integer for compile time
- * checks.
+/** The library version as integer for runtime checks. Also available as
+ * macro CMARK_VERSION for compile time checks.
*
* * Bits 16-23 contain the major version.
* * Bits 8-15 contain the minor version.
@@ -508,18 +509,11 @@ char *cmark_render_man(cmark_node *root, long options);
*
* In hexadecimal format, the number 0x010203 represents version 1.2.3.
*/
-#define CMARK_VERSION 0x000100
-
-/** Macro containing the library version string for compile time checks.
- */
-#define CMARK_VERSION_STRING "0.1.0"
-
-/** The library version as integer for runtime checks.
- */
CMARK_EXPORT
extern const int cmark_version;
-/** The library version string for runtime checks.
+/** The library version string for runtime checks. Also available as
+ * macro CMARK_VERSION_STRING for compile time checks.
*/
CMARK_EXPORT
extern const char cmark_version_string[];
diff --git a/src/cmark_version.h.in b/src/cmark_version.h.in
new file mode 100644
index 0000000..41de3ac
--- /dev/null
+++ b/src/cmark_version.h.in
@@ -0,0 +1,7 @@
+#ifndef CMARK_VERSION_H
+#define CMARK_VERSION_H
+
+#define CMARK_VERSION ((@PROJECT_VERSION_MAJOR@ << 16) | (@PROJECT_VERSION_MINOR@ << 8) | @PROJECT_VERSION_PATCH@)
+#define CMARK_VERSION_STRING "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@"
+
+#endif