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

Cmake overriding find_package #752

Closed
petersteneteg opened this issue Jun 9, 2020 · 2 comments
Closed

Cmake overriding find_package #752

petersteneteg opened this issue Jun 9, 2020 · 2 comments
Labels
Build A problem with building or installing the library.

Comments

@petersteneteg
Copy link
Contributor

In

openexr/CMakeLists.txt

Lines 28 to 36 in 2600cdc

# An "official" way to make this a super-project
# basically overrides the find_package to not find anything
# for stuff we're including locally
set(as_subproject IlmBase OpenEXR)
macro(find_package)
if(NOT "${ARGV0}" IN_LIST as_subproject)
_find_package(${ARGV})
endif()
endmacro()

You override find_package, that is not supported officially by cmake and might be removed in future versions, and one can only do so once, hence if there are more than one project doing it in the same build it will fail.

A better solution is to have your subproject create a "dummy" FindFoo.cmake and put that in a directory at the beginning of the CMAKE_MODULE_PATH, then that dummy package will get found by the find_package(Foo) and then target_link_libraries will work as normally.

I can provide a PR if you want.

@meshula
Copy link
Contributor

meshula commented Jun 10, 2020

A PR would be nice to see, thanks!

@meshula meshula added the Build A problem with building or installing the library. label Jun 10, 2020
@cary-ilm
Copy link
Member

Closing, as this seems to have been addressed by #775.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build A problem with building or installing the library.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants