On 3/12/19 6:57 AM, Lassi Niemistö wrote:
> What to do in order to get rid of the extlib_interface workaround?
> I have not yet seen any means of "exporting" the properties of an
> imported target to tree2.

The file `cmake_test_system_lassi/tree1/Tree1Config.cmake` should
have code to re-create the extlib imported target with whatever
usage requirements it had for building tree1.  See the patch below.
In combination with removing all the `extlib_interface` code, the
`test.sh` script passes.

Generally imported targets are not manually created by project code.
Instead they come from `find_package(MyDependency)`.  Tree1Config
should repeat `find_package(MyDependency)` for public-facing
dependencies.  If you don't want to create a complete find module
for extlib, you can create a normal module that gets `include()`d
from both places.

See the docs here:

  
https://cmake.org/cmake/help/v3.14/manual/cmake-packages.7.html#creating-a-package-configuration-file

-Brad


```
diff --git a/cmake_test_system_lassi/tree1/Tree1Config.cmake 
b/cmake_test_system_lassi/tree1/Tree1Config.cmake
index 45f31f3..65248f3 100644
--- a/cmake_test_system_lassi/tree1/Tree1Config.cmake
+++ b/cmake_test_system_lassi/tree1/Tree1Config.cmake
@@ -1 +1,4 @@
+add_library(extlib SHARED IMPORTED)
+set_target_properties(extlib PROPERTIES IMPORTED_LOCATION 
/tmp/cmake_test_system_lassi/extlib/build/libextlib.so)
+target_include_directories(extlib INTERFACE 
/tmp/cmake_test_system_lassi/extlib/)
 include("${CMAKE_CURRENT_LIST_DIR}/Tree1Targets.cmake")
```
-- 

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-developers

Reply via email to