Re: [CMake] find_package and get_target_property
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 <saadrus...@gmail.com> Date: Friday 13 April 2018 at 15:02 To: "CHEVRIER, Marc" <marc.chevr...@sap.com> Subject: Re: [CMake] find_package and get_target_property Ah I see. In this case, the Libraries I'm depending on are generated, built and installed using CMake. I'm hoping that CMake is able to generate the Find.cmake for me with the appropriate imported targets, as long as INSTALL(export...) was used properly...? On Fri, Apr 13, 2018 at 8:58 AM CHEVRIER, Marc <marc.chevr...@sap.com<mailto:marc.chevr...@sap.com>> 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 <saadrus...@gmail.com<mailto:saadrus...@gmail.com>> Date: Friday 13 April 2018 at 14:50 To: "CHEVRIER, Marc" <marc.chevr...@sap.com<mailto:marc.chevr...@sap.com>> Cc: Cmake Mailing List <cmake@cmake.org<mailto:cmake@cmake.org>> 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: # https://cmake.org/Wiki/CMake/Tutorials/Exporting_and_Importing_Targets 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 <marc.chevr...@sap.com<mailto:marc.chevr...@sap.com>> 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 <cmake-boun...@cmake.org<mailto:cmake-boun...@cmake.org>> on behalf of Saad Khattak <saadrus...@gmail.com<mailto:saadrus...@gmail.com>> Date: Friday 13 April 2018 at 05:29 To: Cmake Mailing List <cmake@cmake.org<mailto:cmake@cmake.org>> 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
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: # https://cmake.org/Wiki/CMake/Tutorials/Exporting_and_Importing_Targets 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, Marcwrote: > 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 on behalf of Saad Khattak < > saadrus...@gmail.com> > *Date: *Friday 13 April 2018 at 05:29 > *To: *Cmake Mailing List > *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
Re: [CMake] find_package and get_target_property
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: CMakeon behalf of Saad Khattak Date: Friday 13 April 2018 at 05:29 To: Cmake Mailing List 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