Fix CMake script to use pkgconfig. 46/11146/1 accepted/tizen/20131022.005739 submit/tizen/20131021.140241
authorKrzysztof Opasiak <k.opasiak@samsung.com>
Mon, 21 Oct 2013 09:43:27 +0000 (11:43 +0200)
committerKrzysztof Opasiak <k.opasiak@samsung.com>
Mon, 21 Oct 2013 09:54:24 +0000 (11:54 +0200)
Adjust CMake to solve dependencies automatically
with pkgconfig instead of direct linking.

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

index b8dea33..1c6bdf4 100755 (executable)
@@ -3,21 +3,24 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
 SET (this_target osp-security-service)
 SET (APPID q7097a278m)
 
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${this_target} REQUIRED
+       chromium
+       capi-system-media-key
+       capi-network-bluetooth
+       pkgmgr
+       glib-2.0
+       osp-appfw
+       vconf
+       vconf-internal-keys
+       osp-appfw-server
+       )
+
 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
-       /usr/include/osp
-       /usr/include/osp/app
-       /usr/include/osp/base
-       /usr/include/osp/io
-       /usr/include/chromium
-       /usr/include/osp/security
-       /usr/include/osp/server
-       /usr/include
-       /usr/include/vconf
+       ${${this_target}_INCLUDE_DIRS}
        inc
        )
 
@@ -52,13 +55,10 @@ 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} "-L/usr/lib/osp-server -losp-appfw-server")
-TARGET_LINK_LIBRARIES(${this_target} "-lvconf" )
 TARGET_LINK_LIBRARIES(${this_target} "-ldl" )
 
+TARGET_LINK_LIBRARIES(${this_target} ${${this_target}_LDFLAGS} ${${this_target}_LIBRARIES})
+
 ## Cory additional info
 INSTALL(TARGETS ${this_target} DESTINATION ../usr/apps/${APPID}/bin)
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/manifest.xml DESTINATION ../usr/apps/${APPID}/info)
index e957a19..5e7f326 100755 (executable)
@@ -16,7 +16,7 @@ BuildRequires:  pkgconfig(osp-appfw)
 BuildRequires:  pkgconfig(vconf)
 BuildRequires:  pkgconfig(vconf-internal-keys)
 
-BuildRequires:  osp-appfw-internal-devel
+BuildRequires:  pkgconfig(osp-appfw-server)
 BuildRequires:  hash-signer
 
 # smack domain requires