1

I am trying to add xapian search engine library in cmake file

project(search)
cmake_minimum_required(VERSION 2.8)
find_package(Xapian REQUIRED)

aux_source_directory(. SRC_LIST)
target_link_libraries(${PROJECT_NAME}
  ${Xapian_LIBRARY}
)
add_executable(${PROJECT_NAME} ${SRC_LIST})

This is not working can any one tell me how to add this if i compile with -lxapian it works

Ramesh
  • 2,295
  • 5
  • 35
  • 64

1 Answers1

1

Swap target_link_libraries() and add_executable() calls. You can link library only to already defined target.

And use ${XAPIAN_LIBRARIES} instead of ${Xapian_LIBRARY}.

arrowd
  • 33,231
  • 8
  • 79
  • 110
  • can u explain the difference between ${XAPIAN_LIBRARIES} and ${Xapian_LIBRARY} – Ramesh Oct 11 '12 at 17:03
  • Sure, there is no `${Xapian_LIBRARY}`. Here are variables that Xapian-Config.cmake defines: https://github.com/xapian/xapian/blob/master/xapian-core/cmake/xapian-config.cmake.in – arrowd Oct 11 '12 at 17:23