Remove unnecessary linker flag on libsyscommon.pc 72/318272/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 05:02:35 +0000 (14:02 +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 87314e3e6ae293dc06d69745e803125ef50bc84b..5412f1cce5ed49dcde3a718c1766353a43cc2e1e 100644 (file)
@@ -61,10 +61,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