summaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
blob: e1ae46bbcfd2bccf86fe8d6d41cf9e9f0bca81ae (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59

SET(PREFIX ${CMAKE_INSTALL_PREFIX})
SET(EXEC_PREFIX "\${prefix}")
SET(VERSION_MAJOR 0)
SET(VERSION "${VERSION_MAJOR}.0.1")

SET(SRCS
	oauth2_error.c
	oauth2_manager.c
	oauth2_request.c
	oauth2_response.c
	oauth2_util.c
)

INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src)

INCLUDE(FindPkgConfig)
if(DEFINED EXCLUDE_EWK_ERR)
    add_definitions(-DWITHOUT_EWK_ERROR)
endif()

if(USE_CHROMIUM_EFL)
	add_definitions(-DWITH_CHROMIUM)
	pkg_check_modules(clientpkgs REQUIRED dlog glib-2.0 gio-2.0 gio-unix-2.0 capi-base-common capi-system-info security-privilege-checker libcurl efl-extension ecore evas chromium-efl json-glib-1.0 elementary)
else()
	pkg_check_modules(clientpkgs REQUIRED dlog glib-2.0 gio-2.0 gio-unix-2.0 capi-base-common capi-system-info security-privilege-checker libcurl efl-extension ecore evas ewebkit2 json-glib-1.0 elementary)
endif()

FOREACH(flag ${clientpkgs_CFLAGS})
	SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)

SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -Werror")
SET(CMAKE_LDFLAGS "-Wl,-zdefs")

ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
ADD_DEFINITIONS("-DFACTORYFS=\"$ENV{FACTORYFS}\"")
ADD_DEFINITIONS("-DSLP_DEBUG")


ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR})
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION})

TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${clientpkgs_LDFLAGS})

CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc @ONLY)

INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIBDIR}/oauth2)
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIBDIR})
INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIBDIR}/pkgconfig)

INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/oauth2.h DESTINATION include)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/oauth2_manager.h DESTINATION include)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/oauth2_request.h DESTINATION include)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/oauth2_response.h DESTINATION include)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/oauth2_error.h DESTINATION include)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/oauth2_types.h DESTINATION include)