Add the base code for gtest verification
[platform/core/connectivity/bluetooth-agent.git] / hf-agent / CMakeLists.txt
index 1ee2094..48a8211 100644 (file)
@@ -1,5 +1,5 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(bluetooth-hf-agent C)
+PROJECT(bluetooth-hf-agent C CXX)
 
 SET(SRCS bluetooth-hf-agent.c
                ../include/bluetooth-agent-profile.c)
@@ -22,6 +22,21 @@ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror")
 ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_hf_agent_LDFLAGS})
 
+IF (BUILD_GTESTS)
+# -fvisibility option should be "default" to call internal functions
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fvisibility=default -fPIC -Werror -Wno-deprecated-declarations -fprofile-arcs -ftest-coverage")
+
+ADD_LIBRARY(hf-agent SHARED ${SRCS})
+SET_TARGET_PROPERTIES(hf-agent
+        PROPERTIES
+        SOVERSION 0.1.0
+        CLEAN_DIRECT_OUTPUT 1)
+
+TARGET_LINK_LIBRARIES(hf-agent ${pkgs_hf_agent_LDFLAGS} -lgcov)
+
+INSTALL(TARGETS hf-agent DESTINATION lib COMPONENT RuntimeLibraries)
+ENDIF (BUILD_GTESTS)
+
 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/org.bluez.hf_agent.service
                DESTINATION share/dbus-1/system-services)