Add the base code for gtest verification
[platform/core/connectivity/bluetooth-agent.git] / ipsp-agent / CMakeLists.txt
index 7c54aa9..476752d 100644 (file)
@@ -1,5 +1,5 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(bluetooth-ipsp-agent C)
+PROJECT(bluetooth-ipsp-agent C CXX)
 
 SET(SRCS bluetooth_ipsp_agent.c
                ../include/bluetooth-agent-profile.c)
@@ -39,6 +39,21 @@ SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
 ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_ipsp_agent_LDFLAGS} -L${CMAKE_CURRENT_SOURCE_DIR}/../bt-api -lbluetooth-api)
 
+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(ipsp-agent SHARED ${SRCS})
+SET_TARGET_PROPERTIES(ipsp-agent
+        PROPERTIES
+        SOVERSION 0.1.0
+        CLEAN_DIRECT_OUTPUT 1)
+
+TARGET_LINK_LIBRARIES(ipsp-agent ${pkgs_ipsp_agent_LDFLAGS} -lgcov)
+
+INSTALL(TARGETS ipsp-agent DESTINATION lib COMPONENT RuntimeLibraries)
+ENDIF (BUILD_GTESTS)
+
 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/org.bluez.ipsp_agent.service DESTINATION share/dbus-1/system-services)