Lmms: Hard-coded library paths in CMake

Created on 7 May 2018  路  5Comments  路  Source: LMMS/lmms

We currently hard-code the paths of libraries we bundle in our packages in make install for Windows platforms:

https://github.com/LMMS/lmms/blob/c1b2728d656a41345d76854fa28fcf597a774296/src/CMakeLists.txt#L181-L218

This breaks make install for MinGW toolchains other than Toby's Trusty PPA and for MSVC.

Instead of hard-coding, we should use FindPackage to locate libraries.

bug compatibility windows

All 5 comments

About 90% of my time in issuing the latest patch for #4352 went into finding a solution of not hard-coding those paths. I eventually gave up. I know it's possible but my cmake knowledge isn't that advanced and internet searches didn't help.

Not hard-coding paths would also protect us when lib x suddenly uses lib y. Ideally, we don't need change anything, let the (cmake) system figure out what libs are needed (to be installed).

About 90% of my time in issuing the latest patch for #4352 went into finding a solution of not hard-coding those paths. I eventually gave up.

Yeah this is not a trivial task and is best done by someone with experience with CMake. Until someone finds the time to work on this, it's probably better to use hard-coded paths for new systems than not supporting them at all.

For Qt 5, this should work.

# Qt libraries
SET(QT_PKG_LIBS Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Xml)
FOREACH (QT_PKG_LIB ${QT_PKG_LIBS})
    GET_TARGET_PROPERTY(Qt5Location ${QT_PKG_LIB} IMPORTED_LOCATION_RELEASE)
    INSTALL(FILES "${Qt5Location}" DESTINATION .)
ENDFOREACH()
# Qt platform plugin
GET_TARGET_PROPERTY(Qt5Location Qt5::QWindowsIntegrationPlugin IMPORTED_LOCATION_RELEASE)
INSTALL(FILES "${Qt5Location}" DESTINATION ./platforms)

FYI, I have a WIP branch for this problem at https://github.com/lukas-w/lmms/tree/cmake/install-refactor (specifically commits https://github.com/lukas-w/lmms/commit/82b933a7f4ceb689f96e7f5c632f2339c6e4b9bc and https://github.com/lukas-w/lmms/commit/ef8b9f9fa3876490d0c4f56662e97ccc3eced13c) that adds a method to automatically locate all dependencies cross-platform, also supporting cross-compilation.

Should be fixed in #5142.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

binyominzeev picture binyominzeev  路  3Comments

Spekular picture Spekular  路  4Comments

Gabrielxd195 picture Gabrielxd195  路  3Comments

Gabrielxd195 picture Gabrielxd195  路  3Comments

FigyTuna picture FigyTuna  路  3Comments