find_package(xapian REQUIRED)
find_package(ZLIB REQUIRED)

if (WIN32)
  set(WIN_EXTRA_LIBS uuid rpcrt4 ws2_32)
endif()

include_directories(
        ${PROJECT_SOURCE_DIR}/libversion
        ${PROJECT_SOURCE_DIR}/libxml
        ${XAPIAN_INCLUDE_DIR}
        ${ZLIB_INCLUDE_DIRS}
)
add_executable(analzindexer
               analzindexer.cpp
               ${PROJECT_SOURCE_DIR}/templates/icon/analyze.rc
)

target_link_libraries(analzindexer
                      ${XAPIAN_LIBRARIES}
                      ${ZLIB_LIBRARIES}
                      ${WIN_EXTRA_LIBS}
                      ${COVERAGE_LINKER_FLAGS}
                      analyze_version
		      xml
)

add_executable(analzsearch.cgi
               analzsearch.cpp
               ${PROJECT_SOURCE_DIR}/templates/icon/analyze.rc
)

target_link_libraries(analzsearch.cgi
                      analyze_version
                      ${XAPIAN_LIBRARIES}
                      ${ZLIB_LIBRARIES}
                      ${WIN_EXTRA_LIBS}
)

include(ApplyEditbin)
apply_editbin(analzindexer console)
apply_editbin(analzsearch.cgi console)


install(TARGETS analzindexer analzsearch.cgi DESTINATION bin)
