1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
4 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
5 SET(LIBDIR ${LIB_INSTALL_DIR})
6 SET(INCLUDEDIR "${PREFIX}/include/lib${LIBNAME}")
7 SET(PC_NAME ${LIBNAME})
8 SET(PC_LDFLAGS ${LIBNAME})
11 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/${INC_DIR})
29 INCLUDE(FindPkgConfig)
30 pkg_check_modules(${LIBNAME} REQUIRED ${PKG_MODULES})
32 FOREACH(flag ${${LIBNAME}_CFLAGS})
33 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
36 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror -fvisibility=hidden")
37 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
39 ADD_LIBRARY(${LIBNAME} SHARED ${SRCS})
40 TARGET_LINK_LIBRARIES(${LIBNAME} ${${LIBNAME}_LDFLAGS} "-ldl")
42 SET_TARGET_PROPERTIES(${LIBNAME}
49 INSTALL(TARGETS ${LIBNAME} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
51 CONFIGURE_FILE(${LIBNAME}.pc.in ${LIBNAME}.pc @ONLY)
52 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${LIBNAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
54 INSTALL(DIRECTORY ${INC_DIR}/ DESTINATION include/lib${LIBNAME}
56 PATTERN "*_private.h" EXCLUDE
57 PATTERN "${INC_DIR}/*.h"