Brian Waters | 13d9601 | 2017-12-08 16:53:31 -0600 | [diff] [blame] | 1 | # The rt_default extension |
| 2 | PROJECT("Configurable routing extension" C) |
| 3 | |
| 4 | # Check if REG_STARTEND is provided on the host |
| 5 | SET(CHECK_REG_STARTEND_SOURCE_CODE " |
| 6 | #include <unistd.h> |
| 7 | #include <regex.h> |
| 8 | int main() { |
| 9 | return regexec(NULL, NULL, 0, NULL, REG_STARTEND); |
| 10 | } |
| 11 | ") |
| 12 | CHECK_C_SOURCE_COMPILES("${CHECK_REG_STARTEND_SOURCE_CODE}" HAVE_REG_STARTEND) |
| 13 | # Generate the host.h file |
| 14 | CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/rt_default-host.h.in ${CMAKE_CURRENT_BINARY_DIR}/rt_default-host.h) |
| 15 | |
| 16 | # Parser files |
| 17 | BISON_FILE(rtd_conf.y) |
| 18 | FLEX_FILE(rtd_conf.l) |
| 19 | SET_SOURCE_FILES_PROPERTIES(lex.rtd_conf.c rtd_conf.tab.c PROPERTIES COMPILE_FLAGS "-I ${CMAKE_CURRENT_SOURCE_DIR}") |
| 20 | |
| 21 | # List of source files |
| 22 | SET( RT_DEFAULT_SRC |
| 23 | rt_default.c |
| 24 | rt_default.h |
| 25 | lex.rtd_conf.c |
| 26 | rtd_conf.tab.c |
| 27 | rtd_conf.tab.h |
| 28 | rtd_rules.c |
| 29 | ) |
| 30 | |
| 31 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) |
| 32 | |
| 33 | # Compile these files as a freeDiameter extension |
| 34 | FD_ADD_EXTENSION(rt_default ${RT_DEFAULT_SRC}) |
| 35 | |
| 36 | |
| 37 | #### |
| 38 | ## INSTALL section ## |
| 39 | |
| 40 | # We install with the daemon component because it is a base feature. |
| 41 | INSTALL(TARGETS rt_default |
| 42 | LIBRARY DESTINATION ${INSTALL_EXTENSIONS_SUFFIX} |
| 43 | COMPONENT freeDiameter-daemon) |