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 <jtrulson@ics.com>
This commit is contained in:
Jon Trulson 2016-09-13 11:18:17 -06:00 committed by Noel Eck
parent a08b8bbcb0
commit 6ccab10bbf

View File

@ -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)