Skip to content

Commit 9e3bad2

Browse files
committed
Do not turn on CPPAN_EXECUTABLE for libraries.
1 parent aaa0a63 commit 9e3bad2

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

src/common/config.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,8 @@ void Config::load(const yaml &root)
150150
if (!fs::exists(d))
151151
return;
152152

153-
auto tmp = subdir;
154-
subdir = d.filename().string();
153+
SwapAndRestore r(subdir, d.filename().string());
155154
reload(d);
156-
subdir = tmp;
157155

158156
for (auto &[s, p] : projects)
159157
rd.known_local_packages.insert(p.pkg);
@@ -175,10 +173,8 @@ void Config::load(const yaml &root)
175173
return;
176174
if (kv["load_all_packages"].IsDefined() && kv["load_all_packages"].as<bool>())
177175
{
178-
auto tmp = subdir;
179-
subdir = d.filename().string();
176+
SwapAndRestore r(subdir, d.filename().string());
180177
reload(d);
181-
subdir = tmp;
182178

183179
for (auto &[s, p] : projects)
184180
rd.known_local_packages.insert(p.pkg);

src/printers/cmake.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2168,7 +2168,8 @@ endif()
21682168

21692169
// other
21702170
ctx.increaseIndent("target_compile_definitions (${this}");
2171-
ctx.addLine("PRIVATE CPPAN_EXECUTABLE");
2171+
if (d.flags[pfExecutable])
2172+
ctx.addLine("PRIVATE CPPAN_EXECUTABLE");
21722173
ctx.addLine("PRIVATE ${LIBRARY_API}_EXTERN=");
21732174
ctx.decreaseIndent(")");
21742175
}

0 commit comments

Comments
 (0)