/src/CMake/Source/cmDirectoryPropertyHelper.cxx
Line | Count | Source |
1 | | /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying |
2 | | file LICENSE.rst or https://cmake.org/licensing for details. */ |
3 | | #include "cmDirectoryPropertyHelper.h" |
4 | | |
5 | | #include "cmGlobalGenerator.h" |
6 | | #include "cmMakefile.h" |
7 | | #include "cmSystemTools.h" |
8 | | #include "cmValue.h" |
9 | | |
10 | | cmMakefile* cmResolveDirectoryMakefile(cmMakefile& callerMf, |
11 | | std::string const& dirName) |
12 | 0 | { |
13 | 0 | if (dirName.empty()) { |
14 | 0 | return &callerMf; |
15 | 0 | } |
16 | 0 | std::string const dir = cmSystemTools::CollapseFullPath( |
17 | 0 | dirName, callerMf.GetCurrentSourceDirectory()); |
18 | 0 | return callerMf.GetGlobalGenerator()->FindMakefile(dir); |
19 | 0 | } |
20 | | |
21 | | cmGetDirectoryPropertyResult cmGetDirectoryProperty( |
22 | | std::string const& dirName, std::string const& propertyName, |
23 | | cmMakefile& callerMf, cmValue& propertyValue) |
24 | 0 | { |
25 | 0 | cmMakefile* mf = cmResolveDirectoryMakefile(callerMf, dirName); |
26 | 0 | if (!mf) { |
27 | 0 | return cmGetDirectoryPropertyResult::DirectoryNotFound; |
28 | 0 | } |
29 | 0 | return cmGetDirectoryProperty(*mf, propertyName, propertyValue); |
30 | 0 | } |
31 | | |
32 | | cmGetDirectoryPropertyResult cmGetDirectoryProperty( |
33 | | cmMakefile& mf, std::string const& propertyName, cmValue& propertyValue) |
34 | 0 | { |
35 | 0 | propertyValue = mf.GetProperty(propertyName); |
36 | 0 | return cmGetDirectoryPropertyResult::Success; |
37 | 0 | } |