Skip to contentSkip to conversation

Use TARGET_LDFLAGS for cmake shared and module libraries

PATCH New Damien Thébault 2 participants 2 messages Jul 12, 2018 – Jul 19, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Use TARGET_LDFLAGS for cmake shared and module libraries

With cmake packages, we are only using TARGET_LDFLAGS for executables and not for shared libraries.

This patch adds CMAKE_SHARED_LINKER_FLAGS and CMAKE_MODULE_LINKER_FLAGS to the cmake toolchain file so that buildroot TARGET_LDFLAGS are used for shared and module libraries.

---
 support/misc/toolchainfile.cmake.in | 2 ++
 1 file changed, 2 insertions(+)
support/misc/toolchainfile.cmake.in +2 -0
index 1f5d2371ed..6f3c8ca971 100644
@@ -45,6 +45,8 @@ set(CMAKE_BUILD_TYPE @@CMAKE_BUILD_TYPE@@ CACHE STRING "Buildroot build configur
 set(CMAKE_C_FLAGS "@@TARGET_CFLAGS@@" CACHE STRING "Buildroot CFLAGS")
 set(CMAKE_CXX_FLAGS "@@TARGET_CXXFLAGS@@" CACHE STRING "Buildroot CXXFLAGS")
 set(CMAKE_EXE_LINKER_FLAGS "@@TARGET_LDFLAGS@@" CACHE STRING "Buildroot LDFLAGS for executables")
+set(CMAKE_SHARED_LINKER_FLAGS "@@TARGET_LDFLAGS@@" CACHE STRING "Buildroot LDFLAGS for shared libraries")
+set(CMAKE_MODULE_LINKER_FLAGS "@@TARGET_LDFLAGS@@" CACHE STRING "Buildroot LDFLAGS for module libraries")
 
 set(CMAKE_INSTALL_SO_NO_EXE 0)
 
Signature · 1 line
2.18.0
#1 lore raw

PATCH 1/1 Use TARGET_LDFLAGS for cmake shared and module libraries

Hello,

Quoted 11 lines · Damien Th?bault

With cmake packages, we are only using TARGET_LDFLAGS for executables and not for shared libraries.

This patch adds CMAKE_SHARED_LINKER_FLAGS and CMAKE_MODULE_LINKER_FLAGS to the cmake toolchain file so that buildroot TARGET_LDFLAGS are used for shared and module libraries.

---
 support/misc/toolchainfile.cmake.in | 2 ++
 1 file changed, 2 insertions(+)

Applied to master, thanks. We'll see how much build breakage this will cause (or not?) in the next days :-)

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com