[CMake] Usage of export(PACKAGE ...)

Jean-Christophe Fillion-Robin jchris.fillionr at kitware.com
Thu Mar 28 22:00:17 EDT 2013


Hi Folks,

It turns out the "export(PACKAGE ..)" does NOT have issue, the problem was
that the value I associated with <PROJECT_NAME>_DIR was incorrect and since
a <PROJECT_NAME> package had been exported earlier, CMake found one despite
the fact an error would have been expected.

I guess it would make sens to add an option
CMAKE_FIND_PACKAGE_NO_DEFAULT_PATH. Such option would help ensuring no
default path are used where they are not expected.

If needed, we could also add option like:

                CMAKE_FIND_PACKAGE_NO_CMAKE_ENVIRONMENT_PATH
                CMAKE_FIND_PACKAGE_NO_CMAKE_PATH
                CMAKE_FIND_PACKAGE_NO_SYSTEM_ENVIRONMENT_PATH
                CMAKE_FIND_PACKAGE_NO_CMAKE_PACKAGE_REGISTRY
                CMAKE_FIND_PACKAGE_NO_CMAKE_BUILDS_PATH
                CMAKE_FIND_PACKAGE_NO_CMAKE_SYSTEM_PATH
                CMAKE_FIND_PACKAGE_NO_CMAKE_SYSTEM_PACKAGE_REGISTRY

To provide full background, the value associated with <PROJECT_NAME>_DIR
was:

    /path/to/project-install/lib/projname/cmake

on both UNIX and WIN32. The problem was that on WIN32, the following value
was expected:

   /path/to/project-install/cmake

Thanks
Jc


On Thu, Mar 28, 2013 at 5:18 PM, David Cole <dlrdave at aol.com> wrote:

> If <PROJECT_NAME>_DIR is given and has a correct value, it is a bug if
> find_package finds the project anywhere else. Whether that's generally true
> or not, I sort of doubt it. It probably depends on the project itself, and
> the find and/or config files involved.
>
> I second Stephen's request for steps to reproduce.
>
> If it's true, it's a bug that should be fixed, not something where we
> should deprecate export(PACKAGE or add warnings...
>
>
> Just my opinion,
> David C.
>
>
>
>
>
> -----Original Message-----
> From: Stephen Kelly <steveire at gmail.com>
> To: cmake <cmake at cmake.org>
> Sent: Thu, Mar 28, 2013 5:12 pm
> Subject: Re: [CMake] Usage of export(PACKAGE ...)
>
>
> Jean-Christophe Fillion-Robin wrote:
>
>  Hi Folks,
>>
>> I would like to discussed the usable of "export(PACKAGE ...)"
>>
> statement.
>
>>
>> Based on my experience, it turns out that exporting the build tree in
>>
> the
>
>> system package registry is a bad idea when building the same package
>> multiple time as it is done on a dashboard client or a developer
>> workstation trying out multiple configurations. Indeed, when
>> "find_package" is used in "CONFIG" (or "NO_MODULE") mode, by default
>>
> CMake
>
>> will search into the CMAKE_SYSTEM_PACKAGE_REGISTRY and will resolve
>>
> to an
>
>> already generated build tree instead of the one passed using
>> <PROJECT_NAME>_DIR.
>>
>> What do you think ? Should we deprecate the use of "export(PACKAGE
>>
> ..)" or
>
>> add a warning in the documentation ?
>>
>> Reference:
>> http://www.cmake.org/cmake/**help/v2.8.10/cmake.html#**command:export<http://www.cmake.org/cmake/help/v2.8.10/cmake.html#command:export>
>>
>>
> I filed http://public.kitware.com/Bug/**view.php?id=13747<http://public.kitware.com/Bug/view.php?id=13747>about this some time
> ago, but I haven't tried to reproduce it since, and I don't have a testplan
> for it. Could you describe a reliable way to reproduce the problem?
>
> Thanks,
>
> Steve.
>
>
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/**
> opensource/opensource.html<http://www.kitware.com/opensource/opensource.html>
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/**CMake_FAQ<http://www.cmake.org/Wiki/CMake_FAQ>
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/**listinfo/cmake<http://www.cmake.org/mailman/listinfo/cmake>
>
>  --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/**
> opensource/opensource.html<http://www.kitware.com/opensource/opensource.html>
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/**CMake_FAQ<http://www.cmake.org/Wiki/CMake_FAQ>
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/**listinfo/cmake<http://www.cmake.org/mailman/listinfo/cmake>
>



-- 
+1 919 869 8849
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130328/80cb38c3/attachment.htm>


More information about the CMake mailing list