Navigation


Changeset 285:0daf6fc2b751 in freeDiameter for freeDiameter/tests/CMakeLists.txt


Ignore:
Timestamp:
Apr 30, 2010, 5:55:16 PM (14 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Added a test case for the app_acct extension

File:
1 edited

Legend:

Unmodified
Added
Removed
  • freeDiameter/tests/CMakeLists.txt

    r29 r285  
    5050ADD_LIBRARY(fDcore STATIC ${TEST_COMMON_SRC})
    5151
     52##############################
     53# App_acct test
     54
     55IF(BUILD_APP_ACCT)
     56        OPTION(TEST_APP_ACCT "Test app_acct extension? (Requires a configured database, see testappacct.c for details)" OFF)
     57        IF(TEST_APP_ACCT)
     58       
     59                OPTION(TEST_APP_ACCT_CONNINFO "The connection string to the database")
     60                IF(TEST_APP_ACCT_CONNINFO)
     61                        ADD_DEFINITIONS(-DTEST_CONNINFO="${TEST_APP_ACCT_CONNINFO}")
     62                ENDIF(TEST_APP_ACCT_CONNINFO)
     63       
     64                SET(TEST_LIST ${TEST_LIST} testappacct)
     65
     66                # Extension dependencies
     67                FIND_PACKAGE(PostgreSQL REQUIRED)
     68                INCLUDE_DIRECTORIES(${POSTGRESQL_INCLUDE_DIR})
     69                SET(testappacct_ADDITIONAL_LIB ${POSTGRESQL_LIBRARIES})
     70
     71                # List of source files, copied from the extension CMakeLists.
     72                SET( APP_ACCT_SRC
     73                        app_acct.h
     74                        app_acct.c
     75                        acct_db.c
     76                        acct_records.c
     77                )
     78                SET( APP_ACCT_SRC_GEN
     79                        lex.acct_conf.c
     80                        acct_conf.tab.c
     81                        acct_conf.tab.h
     82                )
     83
     84                # The extension headers
     85                INCLUDE_DIRECTORIES( "../../extensions/app_acct" )
     86
     87                SET(testappacct_ADDITIONAL "")
     88
     89                FOREACH( SRC_FILE ${APP_ACCT_SRC})
     90                   SET(testappacct_ADDITIONAL ${testappacct_ADDITIONAL} "../../extensions/app_acct/${SRC_FILE}")
     91                ENDFOREACH(SRC_FILE)
     92
     93                FOREACH( SRC_FILE ${APP_ACCT_SRC_GEN})
     94                   SET(testappacct_ADDITIONAL ${testappacct_ADDITIONAL} "${CMAKE_CURRENT_BINARY_DIR}/../../extensions/app_acct/${SRC_FILE}")
     95                ENDFOREACH(SRC_FILE)
     96
     97        ENDIF(TEST_APP_ACCT)
     98ENDIF(BUILD_APP_ACCT)
     99
    52100
    53101#############################
    54102# Compile each test
    55103FOREACH( TEST ${TEST_LIST} )
    56    ADD_EXECUTABLE(${TEST} ${TEST}.c tests.h)
    57    TARGET_LINK_LIBRARIES(${TEST} fDcore ${FD_LIBS})
     104   ADD_EXECUTABLE(${TEST} ${TEST}.c tests.h ${${TEST}_ADDITIONAL})
     105   TARGET_LINK_LIBRARIES(${TEST} fDcore ${FD_LIBS} ${${TEST}_ADDITIONAL_LIB})
    58106   ADD_TEST(${TEST} ${EXECUTABLE_OUTPUT_PATH}/${TEST})
    59107ENDFOREACH( TEST )
Note: See TracChangeset for help on using the changeset viewer.