Brian Waters | 13d9601 | 2017-12-08 16:53:31 -0600 | [diff] [blame] | 1 | # The rt_ereg extension |
| 2 | PROJECT("Regular expression matching based 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 | IF (HAVE_REG_STARTEND) |
| 14 | ADD_DEFINITIONS(-DHAVE_REG_STARTEND) |
| 15 | ENDIF (HAVE_REG_STARTEND) |
| 16 | |
| 17 | |
| 18 | # Parser files |
| 19 | BISON_FILE(rtereg_conf.y) |
| 20 | FLEX_FILE(rtereg_conf.l) |
| 21 | SET_SOURCE_FILES_PROPERTIES(lex.rtereg_conf.c rtereg_conf.tab.c PROPERTIES COMPILE_FLAGS "-I ${CMAKE_CURRENT_SOURCE_DIR}") |
| 22 | |
| 23 | # List of source files |
| 24 | SET( RTEREG_SRC |
| 25 | rtereg.c |
| 26 | rtereg.h |
| 27 | lex.rtereg_conf.c |
| 28 | rtereg_conf.tab.c |
| 29 | rtereg_conf.tab.h |
| 30 | ) |
| 31 | |
| 32 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) |
| 33 | |
| 34 | # Compile these files as a freeDiameter extension |
| 35 | FD_ADD_EXTENSION(rt_ereg ${RTEREG_SRC}) |
| 36 | |
| 37 | |
| 38 | #### |
| 39 | ## INSTALL section ## |
| 40 | |
| 41 | # We install with the daemon component because it is a base feature. |
| 42 | INSTALL(TARGETS rt_ereg |
| 43 | LIBRARY DESTINATION ${INSTALL_EXTENSIONS_SUFFIX} |
| 44 | COMPONENT freeDiameter-daemon) |