find_package and get_target_property

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

find_package and get_target_property

Saad Khattak
Hi,

I am successfully able to find a package using find_package(LibA) but I cannot do a get_target_property on the package as I get the error:

get_target_property() called with non-existent target "LibA"

How do I go about the target properties for a package?

- Saad

--

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: find_package and get_target_property

CHEVRIER, Marc

The creation of “imported” target is the responsibility of the package. May be the package “LibA” does not create a such target.

In this case, you have to rely on variables (like LibA_LIBRARIES and so on…). The documentation of the package, if any, generally describe how to use the package.

 

 

From: CMake <[hidden email]> on behalf of Saad Khattak <[hidden email]>
Date: Friday 13 April 2018 at 05:29
To: Cmake Mailing List <[hidden email]>
Subject: [CMake] find_package and get_target_property

 

Hi,

 

I am successfully able to find a package using find_package(LibA) but I cannot do a get_target_property on the package as I get the error:

 

get_target_property() called with non-existent target "LibA"

 

How do I go about the target properties for a package?

 

- Saad


--

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: find_package and get_target_property

Saad Khattak
Thanks Marc. I assume you mean the library does not export its targets properly? Something like this:

install(TARGETS generator DESTINATION lib/myproj/generators EXPORT myproj-targets)
install(EXPORT myproj-targets DESTINATION lib/myproj)

On Fri, Apr 13, 2018 at 3:05 AM CHEVRIER, Marc <[hidden email]> wrote:

The creation of “imported” target is the responsibility of the package. May be the package “LibA” does not create a such target.

In this case, you have to rely on variables (like LibA_LIBRARIES and so on…). The documentation of the package, if any, generally describe how to use the package.

 

 

From: CMake <[hidden email]> on behalf of Saad Khattak <[hidden email]>
Date: Friday 13 April 2018 at 05:29
To: Cmake Mailing List <[hidden email]>
Subject: [CMake] find_package and get_target_property

 

Hi,

 

I am successfully able to find a package using find_package(LibA) but I cannot do a get_target_property on the package as I get the error:

 

get_target_property() called with non-existent target "LibA"

 

How do I go about the target properties for a package?

 

- Saad


--

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: find_package and get_target_property

CHEVRIER, Marc

Using ‘install(EXPORT …)’ you can generate required files to manage imported targets BUT building and exporting targets must be done in a different build environment from the one which imports the targets.

 

 

From: Saad Khattak <[hidden email]>
Date: Friday 13 April 2018 at 15:02
To: "CHEVRIER, Marc" <[hidden email]>
Subject: Re: [CMake] find_package and get_target_property

 

 

On Fri, Apr 13, 2018 at 8:58 AM CHEVRIER, Marc <[hidden email]> wrote:

Not necessarily. It depends how the package was created. Using EXPORT is a possibility to generate a Config file for the package.

Another possibility is to have a FindLibA.cmake file which creates an imported target by using command ‘add_library (LibA SHARED IMPORTED)’.

 

 

From: Saad Khattak <[hidden email]>
Date: Friday 13 April 2018 at 14:50
To: "CHEVRIER, Marc" <
[hidden email]>
Cc: Cmake Mailing List <
[hidden email]>
Subject: Re: [CMake] find_package and get_target_property

 

Thanks Marc. I assume you mean the library does not export its targets properly? Something like this:

 

install(TARGETS generator DESTINATION lib/myproj/generators EXPORT myproj-targets)

install(EXPORT myproj-targets DESTINATION lib/myproj)

 

On Fri, Apr 13, 2018 at 3:05 AM CHEVRIER, Marc <[hidden email]> wrote:

The creation of “imported” target is the responsibility of the package. May be the package “LibA” does not create a such target.

In this case, you have to rely on variables (like LibA_LIBRARIES and so on…). The documentation of the package, if any, generally describe how to use the package.

 

 

From: CMake <[hidden email]> on behalf of Saad Khattak <[hidden email]>
Date: Friday 13 April 2018 at 05:29
To: Cmake Mailing List <
[hidden email]>
Subject: [CMake] find_package and get_target_property

 

Hi,

 

I am successfully able to find a package using find_package(LibA) but I cannot do a get_target_property on the package as I get the error:

 

get_target_property() called with non-existent target "LibA"

 

How do I go about the target properties for a package?

 

- Saad


--

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