summaryrefslogtreecommitdiff
path: root/src/components/rpc_base
diff options
context:
space:
mode:
authorIvo Stoilov (GitHub) <istoilov@luxoft.com>2017-01-04 12:07:16 +0200
committerGitHub <noreply@github.com>2017-01-04 12:07:16 +0200
commit15fc6572395056b43cd6fbf23737048772daa350 (patch)
treea3ad387b922123ff1d63d5ded3eac0c8535a8ccc /src/components/rpc_base
parent4ff12fe67f0ed15700fd030690276712ef23659d (diff)
parent22b926d4af4e4aab9ae0746d2bfd8625ceadcc9d (diff)
downloadsdl_core-15fc6572395056b43cd6fbf23737048772daa350.tar.gz
Merge pull request #1144 from istoilovgithub/fix/cmake_files_refactoring
Refactor CMake files
Diffstat (limited to 'src/components/rpc_base')
-rw-r--r--src/components/rpc_base/CMakeLists.txt28
-rw-r--r--src/components/rpc_base/test/CMakeLists.txt31
2 files changed, 26 insertions, 33 deletions
diff --git a/src/components/rpc_base/CMakeLists.txt b/src/components/rpc_base/CMakeLists.txt
index 94e67cc985..700cec72bb 100644
--- a/src/components/rpc_base/CMakeLists.txt
+++ b/src/components/rpc_base/CMakeLists.txt
@@ -28,31 +28,27 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
-
-set(RPC_BASE_INCLUDE_DIR ${COMPONENTS_DIR}/rpc_base/include)
+include(${CMAKE_SOURCE_DIR}/tools/cmake/helpers/sources.cmake)
include_directories(
- include
+ ${COMPONENTS_DIR}/rpc_base/include
+ ${COMPONENTS_DIR}/utils/include
${JSONCPP_INCLUDE_DIRECTORY}
)
-set (SOURCES
- ${COMPONENTS_DIR}/rpc_base/src/rpc_base/rpc_base.cc
+set(PATHS
+ ${CMAKE_CURRENT_SOURCE_DIR}/include
+ ${CMAKE_CURRENT_SOURCE_DIR}/src
)
+collect_sources(SOURCES "${PATHS}")
-set (HEADERS
- ${RPC_BASE_INCLUDE_DIR}/rpc_base/gtest_support.h
- ${RPC_BASE_INCLUDE_DIR}/rpc_base/rpc_base_dbus_inl.h
- ${RPC_BASE_INCLUDE_DIR}/rpc_base/rpc_base.h
- ${RPC_BASE_INCLUDE_DIR}/rpc_base/rpc_base_inl.h
- ${RPC_BASE_INCLUDE_DIR}/rpc_base/rpc_base_json_inl.h
- ${RPC_BASE_INCLUDE_DIR}/rpc_base/rpc_message.h
- ${RPC_BASE_INCLUDE_DIR}/rpc_base/validation_report.h
+set(LIBRARIES
+ jsoncpp
)
-add_library(rpc_base ${HEADERS} ${SOURCES})
-target_link_libraries(rpc_base jsoncpp)
+add_library(rpc_base ${SOURCES})
+target_link_libraries(rpc_base ${LIBRARIES})
if(BUILD_TESTS)
add_subdirectory(test)
-endif() \ No newline at end of file
+endif()
diff --git a/src/components/rpc_base/test/CMakeLists.txt b/src/components/rpc_base/test/CMakeLists.txt
index 76cf738f46..566f0ddcde 100644
--- a/src/components/rpc_base/test/CMakeLists.txt
+++ b/src/components/rpc_base/test/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2015, Ford Motor Company
+# Copyright (c) 2016, Ford Motor Company
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -28,8 +28,9 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
-if (BUILD_TESTS)
- include_directories (
+include(${CMAKE_SOURCE_DIR}/tools/cmake/helpers/sources.cmake)
+
+include_directories(
${COMPONENTS_DIR}/dbus/include
${COMPONENTS_DIR}/dbus/src
${COMPONENTS_DIR}/rpc_base/include
@@ -43,20 +44,16 @@ set(LIBRARIES
jsoncpp
)
-set(SOURCES
- rpc_base_json_test.cc
- rpc_base_test.cc
- validation_report_test.cc
-)
-
-if (${HMI_DBUS_API})
- # Build dbus tests
+if(${HMI_DBUS_API})
include_directories(${DBUS_INCLUDE_DIRS})
- set (LIBRARIES ${LIBRARIES} DBus)
- set (SOURCES ${SOURCES} rpc_base_dbus_test.cc)
-endif ()
-
-create_test("rpc_base_test" "${SOURCES}" "${LIBRARIES}")
-
+ list(APPEND LIBRARIES
+ DBus
+ )
+else()
+ set(EXCLUDE_PATHS
+ rpc_base_dbus_test.cc
+ )
endif()
+collect_sources(SOURCES "${CMAKE_CURRENT_SOURCE_DIR}" "${EXCLUDE_PATHS}")
+create_test(rpc_base_test "${SOURCES}" "${LIBRARIES}")