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.
Any new about this ? For now, changing APPEND to PREPEND fix pretty much the issues I had, making CMake use the vcpkg libraries before tryiing systems one.
@Nemirtingas There are two scenarios here:
./vcpkg remove zlib, then use find_package to find zlib on your own machine.The thing is that my project looks for zlib, I build zlib with vcpkg (because curl needs it), but when building curl, it gets the system's zlib, not the one built by vcpkg
So you should execute the following steps:
./vcpkg remove zlib --recurse./vcpkg install curl --editable and terminate the build processfind_package(ZLIB QUIET)./vcpkg install curl --editableDoing so, I must again set a special case in my own project that also use zlib, and protobuf that has a feature to use zlib. In fact doing so I must modify every port that uses zlib to find the vcpkg one ?
@Nemirtingas I believe that because you modified the code of zlib, so you must use zlib on your machine.
In fact, you can apply the modification to the zlib of vcpkg to solve this problem once and for all without needing to modify curl.
I did not modify zlib.
I just used vcpkg install curl protobuf[zlib]
Doing so, zlib is build and installed by vcpkg, but all ports that use it show the line:
Found ZLIB: /usr/lib/libz.tbd (found version "1.2.11")
When changing the APPEND to PREDEND in vcpkg, I got
Found ZLIB: /vcpkg/x86-darwin-release/lib/libz.a
Oh, I know what you mean.
Yes, I think you are right, I will discuss with my colleagues.
Oh, I know what you mean.
Yes, I think you are right, I will discuss with my colleagues.
Ok thanks. I use my fork for now, so it doesn't really impact my builds. Thankfully vcpkg is editable ;)
oh, this definitely seems like an issue. @JackBoosY could you open a PR to fix this?