From 6ccab10bbf0fff41dba889c49741afaeae8527be Mon Sep 17 00:00:00 2001 From: Jon Trulson Date: Tue, 13 Sep 2016 11:18:17 -0600 Subject: [PATCH] src/CMakeLists.txt: "export" lib C and C++ targets to the calling modules With the switch to using a function rather than a macro, $libname is no longer available to module CMakeLists.txt files. These are useful for adding dependencies (for example a module depending on another module). Now ${libnamec} (for C library) and ${libnamecxx} (for C++ library) targets are made available to the module CMakeLists.txt files for their use. Signed-off-by: Jon Trulson --- src/CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7603f75a..028fcd19 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -272,6 +272,11 @@ function (UPM_MIXED_MODULE_INIT) if (NOT ${libname} MATCHES "utilities-c") target_link_libraries (${libname} utilities-c) endif() + + ## "export" the logical C lib target for the calling module's + ## CMakeLists.txt + set (libnamec ${libname} PARENT_SCOPE) + endif (UPM_MIXED_MODULE_INIT_C_SRC) # Build C++ if enabled AND C++ headers exist @@ -292,7 +297,13 @@ function (UPM_MIXED_MODULE_INIT) if (UPM_MIXED_MODULE_INIT_CPP_WRAPS_C) target_link_libraries(${libname} ${libname}-c) endif (UPM_MIXED_MODULE_INIT_CPP_WRAPS_C) + + ## "export" the logical C++ lib target for the calling module's + ## CMakeLists.txt + set (libnamecxx ${libname} PARENT_SCOPE) + endif (BUILDCPP AND UPM_MIXED_MODULE_INIT_CPP_HDR) + endfunction (UPM_MIXED_MODULE_INIT) macro(upm_module_init)