capi-system-sensor: clean up CMakeLists.txt and package config file 42/71742/1
authorkibak.yoon <kibak.yoon@samsung.com>
Fri, 27 May 2016 02:48:32 +0000 (11:48 +0900)
committerkibak.yoon <kibak.yoon@samsung.com>
Fri, 27 May 2016 02:48:32 +0000 (11:48 +0900)
- sync with tizne 2.3

Change-Id: I2799feceed46a4a3667ac68304a2cde0cc4daa89
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
CMakeLists.txt
capi-system-sensor.pc.in

index 611b4c7..baae2b3 100644 (file)
@@ -1,18 +1,25 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
 PROJECT(capi-system-sensor)
+INCLUDE(GNUInstallDirs)
 
-# Setup for pkgconfig File
-SET(fw_name "capi-system-sensor")
+SET(DEPENDENTS "dlog sensor capi-base-common")
+SET(VERSION ${FULLVER})
 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
-SET(VERSION 1.0)
+
+SET(PC_NAME ${PROJECT_NAME})
+SET(PC_DESCRIPTION "Sensor C-API library")
+SET(PC_INCLUDEDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/sensor")
+SET(PC_DEPENDENTS "${DEPENDENTS}")
+SET(PC_LIBDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
+SET(PC_LDFLAGS "-l${PROJECT_NAME}")
 
 INCLUDE_DIRECTORIES(include)
 
 # Build options
 INCLUDE(FindPkgConfig)
-pkg_check_modules(${fw_name} REQUIRED dlog sensor capi-base-common)
+PKG_CHECK_MODULES(${PROJECT_NAME} REQUIRED ${DEPENDENTS})
 
-FOREACH(flag ${${fw_name}_CFLAGS})
+FOREACH(flag ${${PROJECT_NAME}_CFLAGS})
     SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)
 
@@ -26,14 +33,14 @@ SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl, --rpath=${LIB_INSTALL_DIR}")
 
 # Complile Source files
 AUX_SOURCE_DIRECTORY(src SOURCES)
-ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
+ADD_LIBRARY(${PROJECT_NAME} SHARED ${SOURCES})
 
-TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS})
-SET_TARGET_PROPERTIES(${fw_name} PROPERTIES VERSION ${FULLVER} SOVERSION ${MAJORVER} CLEAN_DIRECT_OUTPUT 1)
-CONFIGURE_FILE(${fw_name}.pc.in ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc @ONLY)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
-INSTALL(TARGETS ${fw_name} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
-INSTALL(FILES include/sensor.h DESTINATION ${INCLUDE_INSTALL_DIR}/sensor)
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${${PROJECT_NAME}_LDFLAGS})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${FULLVER} SOVERSION ${MAJORVER} CLEAN_DIRECT_OUTPUT 1)
+CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc @ONLY)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT RuntimeLibraries)
+INSTALL(FILES include/sensor.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor)
 
 # ###
 IF(UNIX)
index 2382fc8..c7ebed2 100644 (file)
@@ -2,13 +2,13 @@
 
 prefix=@PREFIX@
 exec_prefix=@PREFIX@/bin
-libdir=@LIB_INSTALL_DIR@
-includedir=@INCLUDE_INSTALL_DIR@/sensor
+libdir=@PC_LIBDIR@
+includedir=@PC_INCLUDEDIR@
 
-Name: capi-system-sensor
-Description: A sensor library
+Name: @PC_NAME@
+Description: @PC_DESCRIPTION@
 Version: @VERSION@
-Requires: capi-base-common
-Libs: -L${libdir} -lcapi-system-sensor
+Requires: @PC_DEPENDENTS@
+Libs: -L${libdir} @PC_LDFLAGS@
 Cflags: -I${includedir}