@@ -38,17 +38,21 @@ std::string format(const char *fmt, Args... args) {
3838 return temp;
3939}
4040
41- std::vector<fs::path> expand_path (const fs::path &p) {
42- std::vector<fs::path > temp;
41+ static std::vector<std::string> expand_cmake_path (const fs::path &p) {
42+ std::vector<std::string > temp;
4343 if (p.filename ().stem ().string () == " *" ) {
4444 auto ext = p.extension ();
4545 for (const auto &f : fs::directory_iterator (p.parent_path ())) {
4646 if (f.path ().extension () == ext) {
47- temp.push_back (f.path ());
47+ temp.push_back (f.path (). string () );
4848 }
4949 }
5050 } else {
51- temp.push_back (p);
51+ temp.push_back (p.string ());
52+ }
53+ // Normalize all paths to work with CMake (it needs a / on Windows as well)
54+ for (auto & path : temp) {
55+ std::replace (path.begin (), path.end (), ' \\ ' , ' /' );
5256 }
5357 return temp;
5458}
@@ -263,7 +267,7 @@ int generate_cmake(const char *path) {
263267 ss << " set(" << detail::to_upper (bin.name ) << " _SOURCES\n " ;
264268 for (const auto &src : bin.sources ) {
265269 auto path = fs::path (src);
266- auto expanded = detail::expand_path (path);
270+ auto expanded = detail::expand_cmake_path (path);
267271 for (const auto &f : expanded) {
268272 ss << " \t " << f << " \n " ;
269273 }
@@ -357,7 +361,7 @@ int generate_cmake(const char *path) {
357361 if (!inst.files .empty ()) {
358362 ss << " \t FILES " ;
359363 for (const auto &file : inst.files ) {
360- auto path = detail::expand_path (fs::path (file));
364+ auto path = detail::expand_cmake_path (fs::path (file));
361365 for (const auto &f : path)
362366 ss << f << " " ;
363367 }
0 commit comments