[CMake] Setting IMPORTED_LOCATION_* for existing packages

Hauke Heibel hauke.heibel at googlemail.com
Thu Sep 22 15:21:27 EDT 2011


Hi Michael,

First, thank you for the feedback.

On Thu, Sep 22, 2011 at 7:19 PM, Michael Hertling <mhertling at online.de> wrote:
> AFAICS, you've a single imported target GTest, and you are continuously
> setting *this* target's location - sometimes for a debug configuration,
> sometimes without configuration - to the location of its *prerequisite*
> libraries reported by the GTest package's find module or config file.

If I am not totally wrong, in this case I am only setting the GTest
libraries and no additional *prerequisite*. The variable
GTEST_LIBRARIES only contains full qualified paths to gtest.lib and
gtestd.lib.

> IMO, this doesn't make any sense. Possibly, you want to set the GTest
> target's IMPORTED_LINK_INTERFACE_LIBRARIES[_<CONFIG>] properties in
> place of the IMPORTED_LOCATION[_<CONFIG>] ones.

Maybe I am wrong, but I just tried to copy what is done in the
FindQt4.cmake file or in other words to manually define what the
export() directive generates. I recognized an issue since I forgot to
define the property IMPORTED_CONFIGURATIONS. If I did not
misunderstand things completely, you were right if GTEST_LIBRARIES
would contain non GTest libs (the prerequisites).

> What do you actually intent to achieve? Introduce a GTest imported
> target and set up its prerequisites reported in GTEST_LIBRARIES as
> it would be done for imported targets from the first?

I think that's pretty much what I want to do. Create the import target
as if GTest were compiled with an export() directive.

> Doesn't the
> GTEST_LIBRARIES variable per se work for you?

To be honest, in this case it does. Maybe the example was bad. I think
I really need it for shared library targets, such as e.g. OpenCL.

I want to prepare my libraries such that in the future a CMake based
installation also collects and installs DLLs of interface libraries. I
am further assuming that if I define a target of mine and link it
against an imported (let's say) OpenCL target with properly specified
IMPORTED_LOCATION (the DLL for shared libs), install() will copy it
for me.

Maybe that's long shot - I need to read more about the actual
installation process and how it deals with dependencies.

Regards,
Hauke


More information about the CMake mailing list