plugin-api: Fix the prefix for pkg_check_modules of CMakeLists.txt 95/289995/3
authorSangYoun Kwak <sy.kwak@samsung.com>
Thu, 16 Mar 2023 11:45:18 +0000 (20:45 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Fri, 17 Mar 2023 07:31:58 +0000 (07:31 +0000)
The command pkg_check_modules in CMakeLists.txt checks modules and sets
variables about these modules.
The names of these variables have their prefix designated by the command
pkg_check_modules like below:
pkg_check_modules(<prefix> REQUIRED <modules>)

Previously, in plugin-api-common, prefix was "pkgs", which is not a
unique name.
In plugin-api-resourced, prefix was ${PROJECT_NAME} but when calling
variables, "pkgs" was used for prefix, which is not correct usage.
This fault was fixed by replacing their prefix as their ${PROJECT_NAME}.

Change-Id: Ide1db4b707f2c6e9f632c0cc36ab4ec654383887
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
src/plugin-api/common/CMakeLists.txt
src/plugin-api/resourced/CMakeLists.txt

index 326139c..8f0e0fe 100644 (file)
@@ -25,8 +25,8 @@ else()
 endif()
 
 INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs REQUIRED ${PKG_MODULES})
-FOREACH(flag ${pkgs_CFLAGS})
+pkg_check_modules(${PROJECT_NAME} REQUIRED ${PKG_MODULES})
+FOREACH(flag ${${PROJECT_NAME}_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)
 
@@ -41,7 +41,7 @@ SET(SRCS
        src/plugin-api-conf.c)
 
 ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS}
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${${PROJECT_NAME}_LDFLAGS}
                        -ldl -Wl,-z,nodelete,--no-undefined)
                SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${PLUGIN_API_COMMON_MAJORVER})
 SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION})
@@ -52,10 +52,10 @@ INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
        FILES_MATCHING PATTERN "*.h")
 
 # CONFIGURE .pc FILE
-FOREACH(include_dirs ${pkgs_INCLUDE_DIRS})
+FOREACH(include_dirs ${${PROJECT_NAME}_INCLUDE_DIRS})
        SET(PLUGIN_COMMON_INCLUDEDIR "${PLUGIN_COMMON_INCLUDEDIR} -I${include_dirs}")
 ENDFOREACH(include_dirs)
-FOREACH(libraries ${pkgs_LIBRARIES})
+FOREACH(libraries ${${PROJECT_NAME}_LIBRARIES})
        SET(PLUGIN_COMMON_LIBS "${PLUGIN_COMMON_LIBS} -l${libraries}")
 ENDFOREACH(libraries)
 CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
index c428dd1..114cbcb 100644 (file)
@@ -44,7 +44,7 @@ SET(SRCS src/plugin-resourced-memory-lmk.c
        ../common/src/plugin-api-conf.c)
 
 ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS}
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${${PROJECT_NAME}_LDFLAGS}
        -ldl -Wl,-z,nodelete,--no-undefined)
 
 SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${PLUGIN_API_RESOURCED_VERSION})
@@ -57,10 +57,10 @@ INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
 )
 
 # CONFIGURE .pc FILE
-FOREACH(include_dirs ${pkgs_INCLUDE_DIRS})
+FOREACH(include_dirs ${${PROJECT_NAME}_INCLUDE_DIRS})
        SET(PLUGIN_RESOURCED_INCLUDEDIR "${PLUGIN_RESOURCED_INCLUDEDIR} -I${include_dirs}")
 ENDFOREACH(include_dirs)
-FOREACH(libraries ${pkgs_LIBRARIES})
+FOREACH(libraries ${${PROJECT_NAME}_LIBRARIES})
        SET(PLUGIN_RESOURCED_LIBS "${PLUGIN_RESOURCED_LIBS} -l${libraries}")
 ENDFOREACH(libraries)
 CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)