Skip to content

How do I use my own lib instead of system libs #13457

@Nemirtingas

Description

@Nemirtingas

Hi,
I'd like to use my own built libs instead of the system's one by default.
I saw in scripts/buildsystems/vcpkg.cmake(L221) this:

...
if(CMAKE_BUILD_TYPE MATCHES "^[Dd][Ee][Bb][Uu][Gg]$" OR NOT DEFINED CMAKE_BUILD_TYPE) #Debug build: Put Debug paths before Release paths.
    list(APPEND CMAKE_PREFIX_PATH
        ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}
    )
    list(APPEND CMAKE_LIBRARY_PATH
        ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/manual-link ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/manual-link
    )
    list(APPEND CMAKE_FIND_ROOT_PATH
        ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}
    )
...

The append directive bothers me because the system lib is found before my own on MacOS. (ZLib)
(System lib): /usr/lib/libz.tbd
(My lib): /tmp/test/vcpkg/x86-darwin-release/lib/libz.a

Is there any way to change this behavior ?

For now, my workaround is to change vcpkg's APPEND to PREPEND.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions