|
|
|
|
@ -9,12 +9,16 @@
|
|
|
|
|
#include <regex> |
|
|
|
|
|
|
|
|
|
CMake::CMake(const boost::filesystem::path &path) { |
|
|
|
|
const auto find_cmake_project = [](const boost::filesystem::path &cmake_path) { |
|
|
|
|
for(auto &line : filesystem::read_lines(cmake_path)) { |
|
|
|
|
const static std::regex project_regex(R"(^ *project *\(.*\r?$)", std::regex::icase); |
|
|
|
|
std::smatch sm; |
|
|
|
|
if(std::regex_match(line, sm, project_regex)) |
|
|
|
|
return true; |
|
|
|
|
const auto find_cmake_project = [](const boost::filesystem::path &file_path) { |
|
|
|
|
std::ifstream input(file_path.string(), std::ofstream::binary); |
|
|
|
|
if(input) { |
|
|
|
|
std::string line; |
|
|
|
|
while(std::getline(input, line)) { |
|
|
|
|
const static std::regex project_regex("^ *project *\\(.*$", std::regex::icase); |
|
|
|
|
std::smatch sm; |
|
|
|
|
if(std::regex_match(line, sm, project_regex)) |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
}; |
|
|
|
|
|