1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
2 PROJECT(hal-api-common C)
5 SET(VERSION "${VERSION_MAJOR}.1.0")
7 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
8 SET(EXEC_PREFIX "${PREFIX}/bin")
9 SET(INCLUDEDIR "${PREFIX}/include")
10 SET(LIBDIR ${CMAKE_LIBDIR_PREFIX})
12 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
20 INCLUDE(FindPkgConfig)
21 pkg_check_modules(pkgs REQUIRED ${PKG_MODULES})
23 FOREACH(flag ${pkgs_CFLAGS})
24 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
27 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -fPIE")
28 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g -fno-omit-frame-pointer -finstrument-functions")
29 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -lrt")
30 SET(CMAKE_EXE_LINKER_FLAGS "-pie")
32 ADD_DEFINITIONS("-DLOG_TAG=\"HALAPI_COMMON\"")
37 ADD_LIBRARY( ${PROJECT_NAME} SHARED ${SRCS})
38 TARGET_LINK_LIBRARIES( ${PROJECT_NAME} ${pkgs_LDFLAGS} -Wl,-z,nodelete,--no-undefined)
39 SET_TARGET_PROPERTIES( ${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR})
40 SET_TARGET_PROPERTIES( ${PROJECT_NAME} PROPERTIES VERSION ${VERSION})
42 CONFIGURE_FILE( ${PROJECT_NAME}.pc ${PROJECT_NAME}.pc @ONLY)
43 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIBDIR}/hal)
44 INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
45 DESTINATION ${INCLUDEDIR}/hal
46 FILES_MATCHING PATTERN "*.h")
47 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc
48 DESTINATION ${LIBDIR}/pkgconfig)