summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
blob: 926d4184bfc47935a3bf157654c156ae14e9f29b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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-rootstrap
)

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)