Skip to content

Commit d2fb42f

Browse files
committed
Early apply env settings. Add cppan_genpb.
1 parent 6340866 commit d2fb42f

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

src/common/settings.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,13 +374,26 @@ String Settings::get_hash() const
374374
h |= configuration;
375375
h |= default_configuration;
376376

377+
for (auto &o : env)
378+
{
379+
//h |= o.first;
380+
//h |= o.second;
381+
// do we really need this here?
382+
#ifdef _WIN32
383+
_putenv_s(o.first.c_str(), o.second.c_str());
384+
#else
385+
setenv(o.first.c_str(), o.second.c_str(), 1);
386+
#endif
387+
}
388+
377389
// besides we track all valuable ENV vars
378390
// to be sure that we'll load correct config
379391
auto add_env = [&h](const char *var)
380392
{
381393
auto e = getenv(var);
382394
if (!e)
383395
return;
396+
h |= String(var);
384397
h |= String(e);
385398
};
386399

src/inserts/functions.cmake

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,6 +1140,25 @@ function(cppan_qt5_wrap_cpp outfiles)
11401140
endif()
11411141
endfunction()
11421142

1143+
########################################
1144+
# MACRO cppan_genpb
1145+
########################################
1146+
1147+
macro(cppan_genpb f)
1148+
get_filename_component(n ${f} NAME_WE)
1149+
get_filename_component(d ${f} DIRECTORY)
1150+
string(REPLACE "${SDIR}" "" d2 "${d}")
1151+
set(n ${d2}/${n})
1152+
add_custom_command(
1153+
OUTPUT
1154+
${BDIR}/${n}.pb.cc
1155+
${BDIR}/${n}.pb.h
1156+
COMMAND
1157+
pvt.cppan.demo.google.protobuf.protoc ${f} --cpp_out=${BDIR}/${d2} -I ${d}
1158+
)
1159+
set(src ${src} ${BDIR}/${n}.pb.cc ${BDIR}/${n}.pb.h)
1160+
endmacro()
1161+
11431162
########################################
11441163
# MACRO cppan_ragel
11451164
########################################

0 commit comments

Comments
 (0)