Fixup CMake to use pkgconfig. 32/10532/1 accepted/tizen/20131007.232058 submit/tizen/20131007.175420
authorKrzysztof Opasiak <k.opasiak@samsung.com>
Thu, 3 Oct 2013 08:52:44 +0000 (10:52 +0200)
committerKrzysztof Opasiak <k.opasiak@samsung.com>
Thu, 3 Oct 2013 16:12:51 +0000 (18:12 +0200)
Change CMake to use pkgconfig instead of
using direct linking to each library.
The reason is to fix build errors.

Change-Id: Ie1328c66ab2a96b09a57596ed16764e16ef921fe
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
CMakeLists.txt
packaging/osp-channel-service.spec

index 1c9d2e6..b6e0255 100644 (file)
@@ -3,23 +3,14 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
 SET (this_target osp-channel-service)
 SET (APPID cp7ipabg4k)
 
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${this_target} REQUIRED glib-2.0 osp-appfw bundle dlog chromium libsoup-2.4 libssl libsmack message-port openssl aul capi-appfw-package-manager osp-appfw-server )
+
 SET(CMAKE_EXECUTABLE_SUFFIX ".exe")
 SET(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/output")
 
 INCLUDE_DIRECTORIES (
-       /usr/include
-       /usr/include/glib-2.0
-       /usr/lib/glib-2.0/include
-       /usr/include/libsoup-2.4
-       /usr/include/dlog
-       /usr/include/appfw
-       /usr/include/openssl
-       /usr/include/osp
-       /usr/include/osp/app
-       /usr/include/osp/base
-       /usr/include/osp/io
-       /usr/include/osp/server
-       /usr/include/chromium
+       ${${this_target}_INCLUDE_DIRS}
        inc
        )
 
@@ -51,20 +42,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 -lchromium")
-TARGET_LINK_LIBRARIES(${this_target} "-lbundle" )
-TARGET_LINK_LIBRARIES(${this_target} "-ldlog" )
-TARGET_LINK_LIBRARIES(${this_target} "-lglib-2.0" )
-TARGET_LINK_LIBRARIES(${this_target} "-lmessage-port" )
-TARGET_LINK_LIBRARIES(${this_target} "-lsmack" )
-TARGET_LINK_LIBRARIES(${this_target} "-lpthread" )
-TARGET_LINK_LIBRARIES(${this_target} "-lcrypto" )
-TARGET_LINK_LIBRARIES(${this_target} "-lsoup-2.4" )
-TARGET_LINK_LIBRARIES(${this_target} "-laul" )
-TARGET_LINK_LIBRARIES(${this_target} "-lcapi-appfw-package-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)
index bb2929e..bd34829 100755 (executable)
@@ -18,7 +18,7 @@ BuildRequires:        pkgconfig(message-port)
 BuildRequires: pkgconfig(openssl)
 BuildRequires:  pkgconfig(aul)
 BuildRequires:  pkgconfig(capi-appfw-package-manager)
-BuildRequires:  osp-appfw-internal-devel
+BuildRequires: pkgconfig(osp-appfw-server)
 BuildRequires:  hash-signer
 
 # runtime requires