Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mariadb_config: cmake: Don't prefix /absolute/file.a with -l #248

Open
wants to merge 1 commit into
base: 3.4
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion mariadb_config/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,15 @@ FUNCTION(GET_LIB_NAME LIB_NAME LIB_OUT)
SET(LIB_FILE ${LIB_NAME})
ENDIF()

# Apparently `LIB_NAME` can be either a library file name,
# or a general linker arguments (e.g. `-L...` or absolute path
# `/path/to/lib.a`).
# We prefix library names with `-l`; all other arguments
# need to be passed on unmodified.
# We detect those by inspecting the first character.
STRING(SUBSTRING ${LIB_NAME} 0 1 LIB_PREFIX)

IF(NOT ${LIB_PREFIX} STREQUAL "-")
IF(NOT (${LIB_PREFIX} STREQUAL "-" OR ${LIB_PREFIX} STREQUAL "/"))
SET(LIB_FILE "-l${LIB_FILE}")
STRING(REPLACE "-llib" "-l" LIB_FILE ${LIB_FILE})
SET(${LIB_OUT} ${LIB_FILE} PARENT_SCOPE)
Expand Down