Fix CMake script to use pkgconfig. 38/10938/1 accepted/tizen/20131022.042750 submit/tizen/20131022.034736
authorKrzysztof Opasiak <k.opasiak@samsung.com>
Tue, 15 Oct 2013 09:29:13 +0000 (11:29 +0200)
committerKrzysztof Opasiak <k.opasiak@samsung.com>
Tue, 15 Oct 2013 09:33:18 +0000 (11:33 +0200)
Edit CMake script to use pkgconfig
and to configure .pc file correctly.

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

index bb6e9e4..26ac70c 100755 (executable)
@@ -2,24 +2,16 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
 
 SET (this_target osp-nfc)
 
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${this_target} REQUIRED glib-2.0 capi-network-nfc osp-net osp-appfw chromium)
+
 SET(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/cmake_build_tmp/output)
 
 INCLUDE_DIRECTORIES(
   inc
        src
        src/inc
-       /usr/include/chromium
-       /usr/include/glib-2.0
-       /usr/lib/glib-2.0/include
-       /usr/include/system
-       /usr/include/network
-       /usr/include/osp
-       /usr/include/osp/app
-       /usr/include/osp/base
-       /usr/include/osp/io
-       /usr/include/osp/net
-       /usr/include/osp/security
-       /usr/include/osp/system
+       ${${this_target}_INCLUDE_DIRS}
     )
 
 SET (${this_target}_SOURCE_FILES
@@ -72,11 +64,10 @@ ADD_LIBRARY (${this_target} SHARED ${${this_target}_SOURCE_FILES})
 ## SET LINKER FLAGS
 SET(CMAKE_SHARED_LINKER_FLAGS -Wl,--no-undefined)
 
-TARGET_LINK_LIBRARIES(${this_target} "-lchromium" )
-TARGET_LINK_LIBRARIES(${this_target} "-L/usr/lib/osp -losp-appfw -losp-net" )
-TARGET_LINK_LIBRARIES(${this_target} "-lcapi-network-nfc" )
 TARGET_LINK_LIBRARIES(${this_target} "-lpthread" )
 
+TARGET_LINK_LIBRARIES(${this_target} ${${this_target}_LDFLAGS} ${${this_target}_LIBRARIES})
+
 SET_TARGET_PROPERTIES(${this_target}
        PROPERTIES
        VERSION ${FULLVER}
@@ -94,5 +85,6 @@ INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/inc/ DESTINATION include/osp FILES_MATCHIN
 INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/src/inc/ DESTINATION include/osp/net FILES_MATCHING PATTERN "*.h")
 
 # pkgconfig file
+SET(PC_LDFLAGS -l${this_target})
 CONFIGURE_FILE(${this_target}.pc.in ${CMAKE_SOURCE_DIR}/${this_target}.pc @ONLY)
 INSTALL(FILES ${CMAKE_SOURCE_DIR}/${this_target}.pc DESTINATION lib/pkgconfig)