-ADD_SUBDIRECTORY(pkg_upgrade)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+PROJECT(pkgmgr-tool_unittests C CXX)
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(pkgmgr-tool_unittests REQUIRED
+ dlog
+ gmock
+ pkgmgr-parser
+ pkgmgr-info
+ libtzplatform-config
+ libsmack
+ sqlite3
+)
+
+FOREACH(flag ${pkgmgr-tool_unittests_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Wall -Werror -fPIE")
+
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -std=c++14")
+SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
+SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
+
+ADD_DEFINITIONS("-DDB_PATH=\"${DB_PATH}\"")
+
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../src/pkg_upgrade/include)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../)
+
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/pkg_upgrade/src PKG_UPGRADE_SRCS)
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/rsc-copy/src RSC_COPY_SRCS)
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../../src/pkg_upgrade/src LIB_SOURCES)
+LIST(REMOVE_ITEM LIB_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../../src/pkg_upgrade/src/main.cc)
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../mock MOCK_SOURCES)
+
+ADD_EXECUTABLE(${PROJECT_NAME}
+ ${PKG_UPGRADE_SRCS}
+ ${RSC_COPY_SRCS}
+ ${MOCK_SOURCES}
+ ${LIB_SOURCES}
+ test_main.cc
+)
+
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${EXTRA_CFLAGS}")
+TARGET_LINK_LIBRARIES(${PROJECT_NAME}
+ ${pkgmgr-tool_unittests_LDFLAGS}
+)
+
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /usr/bin/)
+INSTALL(DIRECTORY pkg_upgrade/data/ DESTINATION ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/pkg_upgrade/data)
+++ /dev/null
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-PROJECT(pkgmgr-tool_unittests C CXX)
-
-INCLUDE(FindPkgConfig)
-PKG_CHECK_MODULES(pkgmgr-tool_unittests REQUIRED
- dlog
- gmock
- pkgmgr-parser
- pkgmgr-info
- libtzplatform-config
- libsmack
- sqlite3
-)
-
-FOREACH(flag ${pkgmgr-tool_unittests_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Wall -Werror -fPIE")
-
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -std=c++14")
-SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
-SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
-
-ADD_DEFINITIONS("-DDB_PATH=\"${DB_PATH}\"")
-
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../../src/pkg_upgrade/include)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../)
-
-AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/src SOURCES)
-AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../../../src/pkg_upgrade/src LIB_SOURCES)
-LIST(REMOVE_ITEM LIB_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../../../src/pkg_upgrade/src/main.cc)
-AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../../mock MOCK_SOURCES)
-
-ADD_EXECUTABLE(${PROJECT_NAME}
- ${SOURCES}
- ${MOCK_SOURCES}
- ${LIB_SOURCES}
-)
-
-SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${EXTRA_CFLAGS}")
-TARGET_LINK_LIBRARIES(${PROJECT_NAME}
- ${pkgmgr-tool_unittests_LDFLAGS}
-)
-
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /usr/bin/)
-INSTALL(DIRECTORY data/ DESTINATION ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/data)