Adjust CMake to use pkgconfig. 33/10533/1
authorKrzysztof Opasiak <k.opasiak@samsung.com>
Thu, 3 Oct 2013 16:20:17 +0000 (18:20 +0200)
committerKrzysztof Opasiak <k.opasiak@samsung.com>
Thu, 3 Oct 2013 16:20:17 +0000 (18:20 +0200)
Change CMake script to use pkgconfig to solve
dependences instead of direct linking to all
libraries. This fix up build issues.

Change-Id: I14dee52aa6d986b4e017277c42a4abce67a09255
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
CMakeLists.txt

index 56f61f0..76f380a 100644 (file)
@@ -3,12 +3,14 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
 SET (this_target osp-connectivity-service)
 SET (APPID 57r43275q7)
 
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${this_target} REQUIRED osp-appfw-server osp-system-server osp-wifi ecore-x wifi-direct vconf tapi pkgmgr osp-telephony osp-nfc osp-net osp-bluetooth osp-appfw glib-2.0 evas ecore chromium capi-telephony-sim capi-system-info capi-system-device capi-network-wifi capi-network-nfc capi-network-connection capi-network-bluetooth capi-appfw-app-manager)
+
 SET(CMAKE_EXECUTABLE_SUFFIX ".exe")
 SET(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/output")
 
 INCLUDE_DIRECTORIES (
-       /usr/include/glib-2.0
-       /usr/lib/glib-2.0/include
+       ${${this_target}_INCLUDE_DIRS}
        /usr/include/osp
        /usr/include/osp/app
        /usr/include/osp/base
@@ -18,20 +20,6 @@ INCLUDE_DIRECTORIES (
        /usr/include/osp/net
        /usr/include/osp/telephony
        /usr/include/osp/server
-       /usr/include/chromium
-       /usr/include/vconf
-       /usr/include/appfw
-       /usr/include/ecore-1
-       /usr/include/evas-1
-       /usr/include/eina-1
-       /usr/include/eina-1/eina
-       /usr/include/bt-service
-       /usr/include/system
-       /usr/include/wifi
-       /usr/include/wifi-direct
-       /usr/include/network
-       /usr/include/telephony
-       /usr/include/telephony-client
        inc
        )
 
@@ -78,11 +66,7 @@ SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
 ## Create Library
 ADD_EXECUTABLE (${this_target} ${${this_target}_SOURCE_FILES})
 
-
-TARGET_LINK_LIBRARIES(${this_target} -Xlinker --no-undefined -Xlinker --as-needed -pie)
-TARGET_LINK_LIBRARIES(${this_target} -Xlinker --version-script=${CMAKE_CURRENT_SOURCE_DIR}/system-service-export.ver)
-TARGET_LINK_LIBRARIES(${this_target} -L/usr/lib/osp -losp-appfw -losp-net -losp-wifi -lchromium -lcapi-network-wifi -lcapi-network-bluetooth -lcapi-network-connection -lcapi-network-nfc -lwifi-direct -lvconf -lcapi-telephony-sim -ltapi -lecore_x -lcapi-appfw-app-manager)
-TARGET_LINK_LIBRARIES(${this_target} "-L/usr/lib/osp-server -losp-appfw-server")
+TARGET_LINK_LIBRARIES(${this_target} ${${this_target}_LDFLAGS} ${${this_target}_LIBRARIES})
 
 ## Cory additional info
 INSTALL(TARGETS ${this_target} DESTINATION ../usr/apps/${APPID}/bin)