Querying project dependencies from the UNIX command-line

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Querying project dependencies from the UNIX command-line

ardi
Hi!

I've never used CMake (well, I'm continuously using it but as a user
only, for building projects, not for maintaining them) . It's quite
possible that I'll adopt CMake for maintaining my projects (I'm in the
process of locating good references for learning "Modern CMake" --I
want to start directly at Modern CMake, and avoiding as much
old-fashioned practices as possible).

However, before learning and adopting CMake, there's a feature that I
need, and I don't know if CMake provides it, or if I'll need to use an
additional tool for it. And that feature is querying dependencies.

For example, I'd like to type "somecommand /path/to/someproject" at
the UNIX command line, and get this output:

Project /path/to/someproject requires the following to be built:
wxWidgets >= 3.0.0
CUDA >= 7.0.0
OpenCV >= 3.3

Furthermore, if another command could show optional requisites, it
would be really great: "anothercommand /path/to/someproject"

Project /path/to/someproject can optionally use the following when being built:
libtiff >= 4.0.0
libzip >= 1.5.0

So, can I get this functionality from plain CMake/CPack ? Or would I
need additional tools (Note: I know about Hunter, but first I'd like
to know if plain CMake does already offer this feature).

Thanks!

ardi
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Querying project dependencies from the UNIX command-line

Johannes Zarl-Zierl-2
Hi Ardi,

Am Mittwoch, 18. Juli 2018, 11:31:50 CEST schrieb ardi:

> For example, I'd like to type "somecommand /path/to/someproject" at
> the UNIX command line, and get this output:
> [...]
> Furthermore, if another command could show optional requisites, it
> would be really great: "anothercommand /path/to/someproject"
>
> Project /path/to/someproject can optionally use the following when being
> built:
> [...]
> So, can I get this functionality from plain CMake/CPack ? Or would I
> need additional tools (Note: I know about Hunter, but first I'd like
> to know if plain CMake does already offer this feature).

I don't think there's something that gives you exactly what you described,
especially not for a random CMake project.

If you can add some commands to the CMakeLists.txt, though, then the
FeatureSummary module may suit your needs.

Basically, you include the module an then add a cmake command like this:
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)

When you run cmake, you'll get a summary of which packages have been found/not
found, and the required version if you supplied one for the corresponding
find_package command.

Cheers,
  Johannes



--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Querying project dependencies from the UNIX command-line

ardi
On Wed, Jul 18, 2018 at 10:04 PM, Johannes Zarl-Zierl
<[hidden email]> wrote:

> Hi Ardi,
>
> Am Mittwoch, 18. Juli 2018, 11:31:50 CEST schrieb ardi:
>> For example, I'd like to type "somecommand /path/to/someproject" at
>> the UNIX command line, and get this output:
>> [...]
>> Furthermore, if another command could show optional requisites, it
>> would be really great: "anothercommand /path/to/someproject"
>>
>> Project /path/to/someproject can optionally use the following when being
>> built:
>> [...]
>> So, can I get this functionality from plain CMake/CPack ? Or would I
>> need additional tools (Note: I know about Hunter, but first I'd like
>> to know if plain CMake does already offer this feature).
>
> I don't think there's something that gives you exactly what you described,
> especially not for a random CMake project.
>
> If you can add some commands to the CMakeLists.txt, though, then the
> FeatureSummary module may suit your needs.
>
> Basically, you include the module an then add a cmake command like this:
> feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
>
> When you run cmake, you'll get a summary of which packages have been found/not
> found, and the required version if you supplied one for the corresponding
> find_package command.
>
> Cheers,
>   Johannes

Thanks a lot, Johannes!! I was talking about querying such info
without tweaking the CMakeLists.txt, just taking it as it comes from
each project developer. Anyway, the info about required and optional
dependencies is within the CMakeLists.txt of every project, and of
course CMake gets all that info when building a project, so I'm
guessing that, even if there's currently no command-line flag for
telling CMake to dump to stdout the required or the optional
dependencies, it shouldn't be hard to patch CMake for adding such
flag, or alternatively writing a simple utility that does the job,
linked with a small part of the CMake source code.

Thanks!

ardi
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake