Moved expand_envvars.

Signed-off-by: Martin Bremmer <martin.bremmer@adlinktech.com>
This commit is contained in:
Martin Bremmer 2019-04-11 14:10:08 +02:00
parent 17f9c361ea
commit 973ae87e17
5 changed files with 150 additions and 12 deletions

View file

@ -171,14 +171,5 @@ function(add_mpt_executable TARGET)
target_include_directories(${TARGET} PRIVATE "${MPT_DIR}/include" "${MPT_BINARY_ROOT_DIR}/mpt/include")
target_link_libraries(${TARGET} PRIVATE ddsc)
# We need the 'expand environment variables' feature that is present in the
# 'util' module. However, it is currently not possible to properly link to
# that module on Windows. In the near future, the utils will be migrated to
# ddsrt, after which we automatically have access to expand_envvars.
# But until then, use this very ugly (but quick) hack to solve our immediate
# build issues.
target_include_directories(${TARGET} PRIVATE "${CMAKE_SOURCE_DIR}/util/include")
target_sources(${TARGET} PRIVATE "${CMAKE_SOURCE_DIR}/util/src/ut_expand_envvars.c")
endfunction()

View file

@ -6,7 +6,6 @@
#include "dds/ddsrt/heap.h"
#include "dds/ddsrt/process.h"
#include "dds/ddsrt/environ.h"
#include "dds/util/ut_expand_envvars.h"
#ifndef _WIN32
#include <sysexits.h>
@ -63,7 +62,7 @@ mpt_export_env(const mpt_env_t *env)
{
if (env) {
while ((env->name != NULL) && (env->value != NULL)) {
char *expanded = ut_expand_envvars(env->value);
char *expanded = ddsrt_expand_envvars(env->value);
ddsrt_setenv(env->name, expanded);
ddsrt_free(expanded);
env++;