Skip to content
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