See https://github.com/shlomif/fortune-mod/issues/16 .
MESSAGE(FATAL_ERROR "Cannot find recode.h anywhere - please install lib recode")
ENDIF ()
+# So it can find config.h
+INCLUDE_DIRECTORIES(BEFORE "${CMAKE_CURRENT_BINARY_DIR}")
+
MACRO(my_exe exe c_file dir)
ADD_EXECUTABLE("${exe}" "${c_file}")
INSTALL(TARGETS "${exe}" RUNTIME DESTINATION "${dir}")
"perl" "${CMAKE_SOURCE_DIR}/run-tests.pl" "--src-dir" "${CMAKE_SOURCE_DIR}" "--cookies" "${COOKIES_STR}"
)
+# Rebuild config.h if ver.txt has changed.
+ADD_CUSTOM_COMMAND(
+ OUTPUT "config.h.in"
+ DEPENDS "ver.txt"
+ COMMAND "touch"
+ ARGS "config.h.in"
+)
+
+SET(AUTOGENERATED_CONFIG_H "config.h was auto-generated from config.h.in . Do not modify directly")
+
+CONFIGURE_FILE(
+ ${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
+ ${CMAKE_CURRENT_BINARY_DIR}/config.h
+ )
+
+
INCLUDE(CPack)
--- /dev/null
+/*
+ * config.h - Configuration file fortune-mod
+ *
+ * ${AUTOGENERATED_CONFIG_H}
+*/
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Version number of package */
+#define VERSION "${VERSION}"
+
+#ifdef __cplusplus
+}
+#endif
#endif /* killing warnings */
#define PROGRAM_NAME "fortune-mod"
-#define PROGRAM_VERSION "1.99.4"
#include <stdbool.h>
#include <rx.h>
#endif
+#include "config.h"
#include "strfile.h"
#define TRUE 1
static char *program_version(void)
{
static char buf[BUFSIZ];
- (void) sprintf(buf, "%s version %s", PROGRAM_NAME, PROGRAM_VERSION);
+ (void) sprintf(buf, "%s version %s", PROGRAM_NAME, VERSION);
return buf;
}
Tbl.str_longlen = 0;
Tbl.str_shortlen = (unsigned int) 0xffffffff;
Tbl.str_delim = (uint8_t)Delimch;
- Tbl.str_version = VERSION;
+ Tbl.str_version = STRFILE_VERSION;
first = Oflag;
add_offset(outf, (int32_t)ftell(inf));
last_off = 0;
((line)[0] == (tbl).str_delim && (line)[1] == '\n')
typedef struct { /* information table */
-#define VERSION 2
+#define STRFILE_VERSION 2
uint32_t str_version; /* version number */
uint32_t str_numstr; /* # of strings in the file */
uint32_t str_longlen; /* length of longest string */