diff --git a/src/tasks/gtest.cpp b/src/tasks/gtest.cpp index c50cab8..65f34ae 100644 --- a/src/tasks/gtest.cpp +++ b/src/tasks/gtest.cpp @@ -14,6 +14,7 @@ cmake create_cmake_tool(arch a, cmake::ops o=cmake::generate) return std::move(cmake(o) .generator(cmake::vs) .architecture(a) + .arg("-Wno-deprecated") .prefix(gtest::source_path() / build_dir) .root(gtest::source_path())); } diff --git a/src/tasks/zlib.cpp b/src/tasks/zlib.cpp index ed1e1cb..2a8950a 100644 --- a/src/tasks/zlib.cpp +++ b/src/tasks/zlib.cpp @@ -87,6 +87,7 @@ cmake zlib::create_cmake_tool(cmake::ops o) return std::move(cmake(o) .generator(cmake::vs) .root(source_path()) + .arg("-Wno-deprecated") .prefix(source_path())); } diff --git a/src/tools/cmake.cpp b/src/tools/cmake.cpp index e763b6d..09d4e21 100644 --- a/src/tools/cmake.cpp +++ b/src/tools/cmake.cpp @@ -47,7 +47,7 @@ cmake& cmake::prefix(const fs::path& s) cmake& cmake::def(const std::string& name, const std::string& value) { - def_.emplace_back(name, value); + arg("-D" + name + "=" + value); return *this; } @@ -63,6 +63,12 @@ cmake& cmake::def(const std::string& name, const char* s) return *this; } +cmake& cmake::arg(std::string s) +{ + args_.push_back(std::move(s)); + return *this; +} + cmake& cmake::architecture(arch a) { arch_ = a; @@ -150,9 +156,7 @@ void cmake::do_generate() if (!prefix_.empty()) p.arg("-DCMAKE_INSTALL_PREFIX=", prefix_); - // macros - for (auto&& [name, value] : def_) - p.arg("-D" + name + "=" + value + ""); + p.args(args_); // `..` by default, overriden by cmd() if (cmd_.empty()) diff --git a/src/tools/cmake.h b/src/tools/cmake.h index 1107594..021e8df 100644 --- a/src/tools/cmake.h +++ b/src/tools/cmake.h @@ -79,6 +79,10 @@ public: cmake& def(const std::string& name, const fs::path& p); cmake& def(const std::string& name, const char* s); + // adds an arbitrary argument, passed verbatim + // + cmake& arg(std::string s); + // sets the architecture, used along with the generator to create the // output directory name, but also to get the proper vcvars environment // variables for the build environment @@ -149,8 +153,8 @@ private: // passed as -DCMAKE_INSTALL_PREFIX fs::path prefix_; - // passed as -Dkey=value - std::vector> def_; + // passed verbatim + std::vector args_; // overrides build directory name fs::path output_;