Skip to content

Commit 607c449

Browse files
lunacddcbaker
authored andcommitted
Fix compilation on Windows mingw
This commit fixes two issues on Windows: 1. MSSTL does not provide an implicit conversion from fs::path to string. 2. fmt and tl-expected are included in are in libcps header files and are thus leaked into targets that depend on libcps. Setting fmt and tl-expected's visibility to PUBLIC solves build failures.
1 parent 5b1fad8 commit 607c449

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ target_include_directories(cps PUBLIC "${CMAKE_CURRENT_BINARY_DIR}")
1818

1919
# Dependencies
2020
find_package(tl-expected 1.0 REQUIRED)
21-
target_link_libraries(cps PRIVATE tl::expected)
21+
target_link_libraries(cps PUBLIC tl::expected)
2222

2323
find_package(fmt 8 REQUIRED)
2424
target_link_libraries(cps PRIVATE fmt::fmt)

src/cps/loader.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ namespace cps::loader {
304304
root = nlohmann::json::parse(input_buffer);
305305
} catch (const nlohmann::json::exception & ex) {
306306
return tl::make_unexpected(
307-
fmt::format("Exception caught while parsing json for `{}.cps`\n{}", std::string{filename}, ex.what()));
307+
fmt::format("Exception caught while parsing json for `{}.cps`\n{}", filename.string(), ex.what()));
308308
}
309309

310310
auto const name = CPS_TRY(get_required<std::string>(root, "package", "name"));
@@ -331,7 +331,7 @@ namespace cps::loader {
331331
.cps_version = std::move(cps_version),
332332
.components = std::move(components),
333333
.cps_path = std::move(cps_path),
334-
.filename = filename,
334+
.filename = filename.string(),
335335
.default_components = std::move(default_components),
336336
.platform = std::move(platform),
337337
.require = std::move(require), // requires is a keyword

src/cps/search.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ namespace cps::search {
323323
if (p.stem() != f.stem()) {
324324
return tl::unexpected(
325325
fmt::format("filepath and cps_path have non overlapping stems, prefix: {}, filename {}",
326-
std::string{p}, std::string{f}));
326+
p.string(), f.string()));
327327
}
328328
p = p.parent_path();
329329
f = f.parent_path();
@@ -440,7 +440,7 @@ namespace cps::search {
440440
for (auto it = split.begin() + 1; it != split.end(); ++it) {
441441
p /= *it;
442442
}
443-
return p;
443+
return p.string();
444444
}
445445
return s;
446446
};

0 commit comments

Comments
 (0)