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

Bugfix: use CMAKE_FIND_ROOT_PATH_BOTH to locate frameworks #7515

Merged
merged 1 commit into from Aug 26, 2020

Conversation

SSE4
Copy link
Contributor

@SSE4 SSE4 commented Aug 6, 2020

closes: #6416

test case adapted from https://github.com/Paultergeist/conan_apple_framework

see find_library documentation.

Changelog: Bugfix: Use CMAKE_FIND_ROOT_PATH_BOTH to locate frameworks.
Docs: omit

  • Refer to the issue that supports this Pull Request.
  • If the issue has missing info, explain the purpose/use case/pain/need that covers this Pull Request.
  • I've read the Contributing guide.
  • I've followed the PEP8 style guides for Python code.
  • I've opened another PR in the Conan docs repo to the develop branch, documenting this one.

Note: By default this PR will skip the slower tests and will use a limited set of python versions. Check here how to increase the testing level by writing some tags in the current PR body text.

Signed-off-by: SSE4 <tomskside@gmail.com>
@@ -850,7 +850,7 @@ class CMakeCommonMacros:
endif()
foreach(_FRAMEWORK ${FRAMEWORKS})
# https://cmake.org/pipermail/cmake-developers/2017-August/030199.html
find_library(CONAN_FRAMEWORK_${_FRAMEWORK}_FOUND NAME ${_FRAMEWORK} PATHS ${CONAN_FRAMEWORK_DIRS${SUFFIX}})
find_library(CONAN_FRAMEWORK_${_FRAMEWORK}_FOUND NAME ${_FRAMEWORK} PATHS ${CONAN_FRAMEWORK_DIRS${SUFFIX}} CMAKE_FIND_ROOT_PATH_BOTH)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great to know when we could use NO_DEFAULT_PATH, because we fully know this is a framework that lives in the Conan package, and forget about all the system paths, and when it would be a system framework and then it could be found in other locations rather than in the ${CONAN_FRAMEWORK_DIRS${SUFFIX}}

Now that we have the system_libs, this could be the same for frameworks? system_frameworks?

Wdyt @danimtb, @jgsogo ?

Copy link
Contributor

@lasote lasote Aug 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. It would be a better model. (Not to do it in this PR, but something to do)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. Then we should turn this bugfix into a feature for 1.29

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I think having a cpp_info.system_frameworks makes sense

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it makes sense, but it will be much larger change - e.g. update several generators at least

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I am not saying that it is a change for this PR, but something to consider for a feature

Copy link
Contributor

@jgsogo jgsogo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly the documentation about find_package, using CMAKE_FIND_ROOT_PATH_BOTH is the default behavior, in fact the proposed tests already pass without the source changes.

@SSE4
Copy link
Contributor Author

SSE4 commented Aug 10, 2020

@jgsogo do you have proof? did you try it to run the test locally with no CMAKE_FIND_ROOT_PATH_BOTH specified?
cause I did, and it fails for me without specifying it.
reading the CMake source code I see that for iOS the default mode is ONLY:
https://github.com/Kitware/CMake/blob/master/Modules/Platform/Darwin.cmake#L10

Copy link
Contributor

@jgsogo jgsogo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, my fault. There are two classes with tests in that file and I was running the wrong one.

Indeed the change is needed to find those frameworks in the cross-compiling scenario

@jgsogo jgsogo added this to the 1.29 milestone Aug 10, 2020
@memsharded memsharded merged commit 0ecea7c into conan-io:develop Aug 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug] Framework library X not found in paths: <blank>
5 participants