[CMake] Printing "Found <package>..." message in config mode

Cyril Boucher cyril.boucher94260 at gmail.com
Thu Aug 16 08:24:00 EDT 2018


Hi Sebastiàn,

Your question got me thinking and I also figured that way of doing it works:

set(<package>_CONFIG ${CMAKE_CURRENT_LIST_FILE})
find_package_handle_standard_args(<package> CONFIG_MODE)

This allows you to keep most of the nice logic inside
FindPackageHandleStandardArgs.

Best regards,
Cyril

2018-08-15 22:13 GMT+02:00 Sebastián Mancilla <smancill at jlab.org>:

> Ah, I see that FIND_PACKAGE_HANDLE_STANDARD_ARGS prints
>
>    -- Find Foo: <path to FooConfig.cmake> (found version "<version>")
>
> I guess my function is not necessary, I can just put inside FooConfig.cmake
>
>     find_package_message(Foo
>       "Found Foo: ${CMAKE_CURRENT_LIST_FILE} (found version
> \"@PACKAGE_VERSION@\")"
>       "[${CMAKE_CURRENT_LIST_FILE}][@PACKAGE_VERSION@]")
>
>
> El mar., 14 de ago. de 2018 a la(s) 19:36, Hendrik Sattler (
> post at hendrik-sattler.de) escribió:
>
>>
>>
>> Am 14. August 2018 22:08:36 MESZ schrieb "Sebastián Mancilla" <
>> smancill at jlab.org>:
>> >Normally, find modules call FIND_PACKAGE_HANDLE_STANDARD_ARGS, which in
>> >turn calls FIND_PACKAGE_MESSAGE, to print a nice message about the
>> >location
>> >and version of the dependency.
>>
>> You can do that with FIND_PACKAGE_HANDLE_STANDARD_ARGS, just use module
>> name and CONFIG_MODE as arguments.
>>
>> HS
>> --
>>
>> Powered by www.kitware.com
>>
>> Please keep messages on-topic and check the CMake FAQ at:
>> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.
>> cmake.org_Wiki_CMake-5FFAQ&d=DwIGaQ&c=lz9TcOasaINaaC3U7FbMev2lsutwpI
>> 4--09aP8Lu18s&r=8hmSv9ww5s9qu3iT8h5WMi8-YcKXaJvelxT3fMih7S4&m=vNaw4PX_
>> cjIs-mDa1mqBspuYYh8zccYAIC84tyoB0oA&s=RJEEiZ1k-XIjXM_90_
>> 6kyZ5FMVIYsSAiyQRThYB3iJ8&e=
>>
>> Kitware offers various services to support the CMake community. For more
>> information on each offering, please visit:
>>
>> CMake Support: https://urldefense.proofpoint.com/v2/url?u=http-3A__cmake.
>> org_cmake_help_support.html&d=DwIGaQ&c=lz9TcOasaINaaC3U7FbMev2lsutwpI
>> 4--09aP8Lu18s&r=8hmSv9ww5s9qu3iT8h5WMi8-YcKXaJvelxT3fMih7S4&m=vNaw4PX_
>> cjIs-mDa1mqBspuYYh8zccYAIC84tyoB0oA&s=LqUR8QOw8X5ya0FRtvJ3J9e40LyNK-
>> gydGXOeaM80Ps&e=
>> CMake Consulting: https://urldefense.proofpoint.
>> com/v2/url?u=http-3A__cmake.org_cmake_help_consulting.html&d=DwIGaQ&c=
>> lz9TcOasaINaaC3U7FbMev2lsutwpI4--09aP8Lu18s&r=8hmSv9ww5s9qu3iT8h5WMi8-
>> YcKXaJvelxT3fMih7S4&m=vNaw4PX_cjIs-mDa1mqBspuYYh8zccYAIC84tyoB0oA&s=
>> N5TtfB9fCMuIe6ZcnAzVHEk5w4MnGzNdZ8hI-zyiU5Y&e=
>> CMake Training Courses: https://urldefense.proofpoint.
>> com/v2/url?u=http-3A__cmake.org_cmake_help_training.html&d=DwIGaQ&c=
>> lz9TcOasaINaaC3U7FbMev2lsutwpI4--09aP8Lu18s&r=8hmSv9ww5s9qu3iT8h5WMi8-
>> YcKXaJvelxT3fMih7S4&m=vNaw4PX_cjIs-mDa1mqBspuYYh8zccYAIC84tyoB0oA&s=
>> aBTzKuF0iyTKifZQ6madT0vT189WJsgYDDf8jDL_JxI&e=
>>
>> Visit other Kitware open-source projects at
>> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.
>> kitware.com_opensource_opensource.html&d=DwIGaQ&c=
>> lz9TcOasaINaaC3U7FbMev2lsutwpI4--09aP8Lu18s&r=8hmSv9ww5s9qu3iT8h5WMi8-
>> YcKXaJvelxT3fMih7S4&m=vNaw4PX_cjIs-mDa1mqBspuYYh8zccYAIC84tyoB0oA
>> &s=Wu5CbQmwVaf6uE5Dp9OK_EASEZ6WS16W0hVEXN_3BAo&e=
>>
>> Follow this link to subscribe/unsubscribe:
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__cmake.
>> org_mailman_listinfo_cmake&d=DwIGaQ&c=lz9TcOasaINaaC3U7FbMev2lsutwpI
>> 4--09aP8Lu18s&r=8hmSv9ww5s9qu3iT8h5WMi8-YcKXaJvelxT3fMih7S4&m=vNaw4PX_
>> cjIs-mDa1mqBspuYYh8zccYAIC84tyoB0oA&s=QViykHUMgtj8XqForeqtw7j16bUM3h
>> Ap3JTzSse90b8&e=
>>
>
>
> --
> Sebastian Mancilla Matta
> CCTVal, UTFSM
> Valparaíso, Chile
>
> --
>
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180816/8928933d/attachment.html>


More information about the CMake mailing list