CMAKE_MINIMUM_REQUIRED(VERSION 2.6) PROJECT(hal-backend-power-generic C) SET(LIBRARY_NAME "hal-backend-power") SET(CMAKE_VERBOSE_MAKEFILE ON) SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(HAL_LIBDIR ${CMAKE_HAL_LIBDIR_PREFIX}) SET(HAL_LICENSEDIR ${CMAKE_HAL_LICENSEDIR_PREFIX}) INCLUDE(FindPkgConfig) pkg_check_modules(pkgs REQUIRED hal-api-common hal-api-power ) FOREACH(flag ${pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/include) SET(SRCS ${PROJECT_SOURCE_DIR}/src/${LIBRARY_NAME}.c ${PROJECT_SOURCE_DIR}/src/sysfs.c) ADD_LIBRARY(${LIBRARY_NAME} SHARED ${SRCS}) TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${pkgs_LDFLAGS} -ldl) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-hal.conf DESTINATION /hal/lib/tmpfiles.d) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE DESTINATION ${HAL_LICENSEDIR}/${PROJECT_NAME}) INSTALL(TARGETS ${LIBRARY_NAME} DESTINATION ${HAL_LIBDIR} COMPONENT RuntimeLibraries)