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

find_dependency() does not support COMPONENTS argument before 3.8.0 #5

Closed
CDitzel opened this issue Feb 26, 2018 · 7 comments
Closed
Labels
bug Something isn't working

Comments

@CDitzel
Copy link

CDitzel commented Feb 26, 2018

after building the lib, I wanted to compile the example, but upon putting cmake .. in a build directory, I got

`CMake Error at /usr/share/cmake-3.5/Modules/CMakeFindDependencyMacro.cmake:45 (message):
Invalid arguments to find_dependency
Call Stack (most recent call first):
/usr/local/lib/cmake/JSONUtils/JSONUtilsConfig.cmake:5 (find_dependency)
CMakeLists.txt:6 (find_package)

-- Configuring incomplete, errors occurred!
See also "/home/me/tempRepos/modern-cmake-sample/example_exec/build/CMakeFiles/CMakeOutput.log".
`

what seems to be the problem here?

@pabloariasal
Copy link
Owner

Which CMake version are you using? What does /home/me/tempRepos/modern-cmake-sample/example_exec/build/CMakeFiles/CMakeOutput.log say?

@pabloariasal
Copy link
Owner

pabloariasal commented Feb 27, 2018

Alright I had to dig a little bit but think I found your issue. The problem is that in your CMake version (v3.5.0), the COMPONENTS argument is not supported by find_dependency(). See the implementation.

    find_package(${dep} ${cmake_fd_version}
        ${cmake_fd_exact_arg}
        ${cmake_fd_quiet_arg}
        ${cmake_fd_required_arg}
    )

Thus the error comes from the line find_dependency(Boost 1.55 REQUIRED COMPONENTS regex) as this is not recognized. Apparently this was only introduced after v1.8.0. I will remove this and use find_package() directly instead. Sorry about this.

@pabloariasal pabloariasal added the bug Something isn't working label Feb 27, 2018
@pabloariasal pabloariasal changed the title Cmake problem find_dependency() does not support COMPONENTS argument before 3.8.0 Feb 27, 2018
Repository owner deleted a comment from CDitzel Feb 27, 2018
@pabloariasal
Copy link
Owner

@CDitzel I commited f6e026e the changes and it should work now with your CMake version.

@CDitzel
Copy link
Author

CDitzel commented Feb 28, 2018

I greatly appreciate it, whats the differencebetween find_package and find_dependency anyway

@pabloariasal
Copy link
Owner

They are practically the same, find_dependency() is just a wrapper around find_package() that produces better error messages as it knows it's being run by downstreams inside a .config

@Y-pandaman
Copy link

Hello, I have the same problem with you. How did you solve it?The latest version of my cmake is 3.5.1. Which version is 3.8.0?

@gunslingerfry
Copy link

I just happened upon this with the same problem @yaolinggezhu . Literally just replace find_dependency with find_package that's all you need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants