Remove unnecessary linker flag on libsyscommon.pc 71/318271/1
authorYoungjae Cho <y0.cho@samsung.com>
Wed, 15 Jan 2025 04:42:10 +0000 (13:42 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Wed, 15 Jan 2025 04:59:42 +0000 (13:59 +0900)
The linker flags pulled in by the variable SYSCOMMON_LIBS caused
problem when the libsyscommon was linked to another program. The
program might have located the libsyscommon by libsyscommon.pc.
Because of this, the program might have added linker flags
unintentionally that were, in fact, dependent to the libsyscommon,
not the program itself. And this causes build error like:
  ld: cannot find -lcynara-creds-pid: No such file or directory
The program didn't intend to link it to libcynara-creds-pid, and
therefore the rpmbuild would also not have installed the library.
But the linker flag -lcynara-creds-pid was pulled in by the
libsyscommon.pc, so it makes build error.

Change-Id: I81c2e4544f1c904527e4015aafb28ef0b2a659e9
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
CMakeLists.txt
libsyscommon.pc.in

index 92a00502c1103c4d47d2190ce1dbc0775d98b0b4..bea15c69e12fe8abf46163e6e4bf29d94867cec9 100644 (file)
@@ -63,10 +63,6 @@ FOREACH(flag ${syscommon_INCLUDE_DIRS})
        SET(SYSCOMMON_INCLUDEDIR "${SYSCOMMON_INCLUDEDIR} -I${flag}")
 ENDFOREACH(flag)
 
-FOREACH(flag ${syscommon_LIBRARIES})
-       SET(SYSCOMMON_LIBS "${SYSCOMMON_LIBS} -l${flag}")
-ENDFOREACH(flag)
-
 CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
 
index 7f29eb38f534504fe4c3bb6ba44240876f79f85d..3cfd5d6e244e457259ccaf314e305fdd4ec23588 100644 (file)
@@ -14,4 +14,4 @@ Description: system common library
 Version: @VERSION@
 Requires.private: gio-2.0 gio-unix-2.0 dlog json-c capi-system-info
 Cflags: -I${includedir} @SYSCOMMON_INCLUDEDIR@
-Libs: -L${libdir} -lsyscommon @SYSCOMMON_LIBS@
+Libs: -L${libdir} -lsyscommon