cpp-subprocess/test/test_env.cc
Haowen Liu f6232a7f26
Improve CMake setup (#118)
* Support CMake 4

CMake 4 has removed compatibility with CMake < 3.5
Bumping minimum required version to 3.5 enables
CMake 4 to build this code.

* Move header into subdir

* Improve CMake setup

This commit configures and installs CMake metadata files. This also
provides the namespaced ALIAS target `cpp-subprocess::subprocess`.

* Update README with CMake instructions

* Update include paths in tests
2025-05-04 20:22:13 +05:30

26 lines
427 B
C++

#include <iostream>
#include <cpp-subprocess/subprocess.hpp>
using namespace subprocess;
#ifndef __USING_WINDOWS__
void test_env()
{
int st= Popen("./env_script.sh", environment{{
{"NEW_ENV1", "VALUE-1"},
{"NEW_ENV2", "VALUE-2"},
{"NEW_ENV3", "VALUE-3"}
}}).wait();
assert (st == 0);
}
#endif
int main() {
#ifndef __USING_WINDOWS__
test_env();
#endif
return 0;
}