From: kibak.yoon Date: Tue, 4 Apr 2017 09:09:50 +0000 (+0900) Subject: sensord: clean up cmake configurations X-Git-Tag: accepted/tizen/unified/20170414.164053^2~66 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cc7f933d04c82c0517397b00a74f0fcd25feb1e6;p=platform%2Fcore%2Fsystem%2Fsensord.git sensord: clean up cmake configurations - fix typos - use uppercase letters in commands - use CMAKE_LD_LIBS macro to link dl library - the sensord executable binary no longer contains a sensor code Change-Id: I23dbdfea814ef2961eea63e8eec9e85e2a88f9eb Signed-off-by: kibak.yoon --- diff --git a/CMakeLists.txt b/CMakeLists.txt index c5d9d08..e91c388 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,12 +7,12 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) # Common Options SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O2 -omit-frame-pointer -std=gnu++0x") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdata-sections -ffunction-sections") -SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-section -Wl,--print-gc-section") +SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections -Wl,--print-gc-sections") MESSAGE("FLAGS: ${CMAKE_CXX_FLAGS}") MESSAGE("FLAGS: ${CMAKE_EXE_LINKER_FLAGS}") # Internal Debugging Options -#add_definitions(-Wall -g -D_DEBUG) +#ADD_DEFINITIONS(-Wall -g -D_DEBUG) # Sub-directory ADD_SUBDIRECTORY(src/shared) diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt index c71bcec..6be6472 100644 --- a/src/server/CMakeLists.txt +++ b/src/server/CMakeLists.txt @@ -6,27 +6,25 @@ SET(DEPENDENTS "glib-2.0 gio-2.0 dlog libsystemd-daemon cynara-client cynara-cre INCLUDE(FindPkgConfig) PKG_CHECK_MODULES(SERVER_PKGS REQUIRED ${DEPENDENTS}) -ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../sensor ${CMAKE_CURRENT_BINARY_DIR}/sensor) ADD_DEFINITIONS(${SENSOR_DEFINITIONS}) -ADD_DEFINITIONS(-DLIBDIR="${LIBDIR}") +ADD_DEFINITIONS(-DLIBDIR="${CMAKE_INSTALL_LIBDIR}") FOREACH(flag ${SERVER_PKGS_CFLAGS}) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}") ENDFOREACH(flag) -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ldl -fPIE") +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIE") SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie") INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/src/shared + ${CMAKE_SOURCE_DIR}/src/sensor ${CMAKE_SOURCE_DIR}/src/hal ${CMAKE_CURRENT_SOURCE_DIR} - ${SENSOR_HEADERS} ) FILE(GLOB SERVER_SRCS *.cpp) ADD_EXECUTABLE(${PROJECT_NAME} ${SENSOR_SRCS} ${SERVER_SRCS}) - -TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${SERVER_PKGS_LDFLAGS} "sensord-shared") - -INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin) +SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${SERVER_PKGS_LDFLAGS} ${CMAKE_DL_LIBS} "sensord-shared") +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/src/shared/CMakeLists.txt b/src/shared/CMakeLists.txt index 69b88ed..eb20325 100644 --- a/src/shared/CMakeLists.txt +++ b/src/shared/CMakeLists.txt @@ -1,7 +1,7 @@ -cmake_minimum_required(VERSION 2.6) -project(sensord-shared CXX) +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(sensord-shared CXX) -SET(DEPENDENTS "dlog") +SET(DEPENDENTS "dlog libsystemd-daemon glib-2.0 gio-2.0") INCLUDE(FindPkgConfig) PKG_CHECK_MODULES(SHARED_PKGS REQUIRED ${DEPENDENTS}) @@ -18,7 +18,5 @@ INCLUDE_DIRECTORIES( FILE(GLOB_RECURSE SRCS *.cpp) ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS}) - TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${SHARED_PKGS_LDFLAGS}) - INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})