Skip to content

[vcpkg] Replace APPEND to PREPEND on vcpkg.cmake#14552

Closed
JackBoosY wants to merge 1 commit intomicrosoft:masterfrom
JackBoosY:dev/jack/13457
Closed

[vcpkg] Replace APPEND to PREPEND on vcpkg.cmake#14552
JackBoosY wants to merge 1 commit intomicrosoft:masterfrom
JackBoosY:dev/jack/13457

Conversation

@JackBoosY
Copy link
Contributor

Change APPEND to PREPEND to avoid finding the system library first.

Fixes #13457.

@JackBoosY JackBoosY added category:vcpkg-bug The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`) info:internal labels Nov 13, 2020
@JackBoosY JackBoosY requested a review from strega-nil November 13, 2020 05:57
@JackBoosY
Copy link
Contributor Author

@Nemirtingas Can you please test this PR?

Thanks.

@JackBoosY
Copy link
Contributor Author

@strega-nil Should I also need to modify line 293 to list(PREPEND CMAKE_PREFIX_PATH "/") ?

@Nemirtingas
Copy link
Contributor

@Nemirtingas Can you please test this PR?

Thanks.

Hi, I will test it asap, thanks.

@Neumann-A
Copy link
Contributor

@strega-nil @JackBoosY
I disagree with this change.
Reason:
a) It wasn't disclosed in #13457 why system libraries are found. CMAKE_LIBRARY_PATH, CMAKE_PREFIX_PATH are normally empty according to the cmake docs and I highly suspect CMAKE_FIND_ROOT_PATH to be also empty. As such the root cause for the issue has not yet been discovered.
b) PREPEND was only added in newer CMake versions.
c) if it would have been a problem an issue would have bubbled up much earlier
d) It changes the default behavior.
e) and most importantly you are screwing up the users. Due to d) it becomes virtually impossible to overwrite vcpkg by setting CMAKE_PREFIX_PATH CMAKE_LIBRARY_PATH in a user toolchain or before the first project() call

@Nemirtingas
Copy link
Contributor

@strega-nil @JackBoosY
I disagree with this change.
Reason:
a) It wasn't disclosed in #13457 why system libraries are found. CMAKE_LIBRARY_PATH, CMAKE_PREFIX_PATH are normally empty according to the cmake docs and I highly suspect CMAKE_FIND_ROOT_PATH to be also empty. As such the root cause for the issue has not yet been discovered.
b) PREPEND was only added in newer CMake versions.
c) if it would have been a problem an issue would have bubbled up much earlier
d) It changes the default behavior.
e) and most importantly you are screwing up the users. Due to d) it becomes virtually impossible to overwrite vcpkg by setting CMAKE_PREFIX_PATH CMAKE_LIBRARY_PATH in a user toolchain or before the first project() call

Hi, I use https://github.com/tpoechtrager/osxcross/blob/master/tools/toolchain.cmake, could this be the cause ?

@Neumann-A
Copy link
Contributor

Yes the toolchain is loaded before vcpkg so it affects everything. I strongly assume that:

# where is the target environment
set(CMAKE_FIND_ROOT_PATH
  "${OSXCROSS_SDK}"
  "${OSXCROSS_TARGET_DIR}/macports/pkgs/opt/local")

is the reason since:

The CMake variable CMAKE_FIND_ROOT_PATH specifies one or more directories to be prepended to all other search directories. This effectively “re-roots” the entire search under given locations. Paths which are descendants of the CMAKE_STAGING_PREFIX are excluded from this re-rooting, because that variable is always a path on the host system. By default the CMAKE_FIND_ROOT_PATH is empty.

I also don't know how the PKGCONFIG environment will interact with VCPKG.

@strega-nil
Copy link
Contributor

Closing as @Neumann-A makes very good points.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category:vcpkg-bug The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How do I use my own lib instead of system libs

5 participants