diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2018-09-19 12:12:35 (GMT) |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2018-09-25 13:59:59 (GMT) |
commit | f9717725f9d4c7f4a1da52b0184365cd757bc076 (patch) | |
tree | ee805f2e0fbd53cc0b2b72728e08496f0df57372 /Source/cmLinkDirectoriesCommand.cxx | |
parent | b5915744ebccd086891f1fab0ae91af54deb3a86 (diff) | |
download | CMake-f9717725f9d4c7f4a1da52b0184365cd757bc076.zip CMake-f9717725f9d4c7f4a1da52b0184365cd757bc076.tar.gz CMake-f9717725f9d4c7f4a1da52b0184365cd757bc076.tar.bz2 |
link_directories(): enhance capabilities
Diffstat (limited to 'Source/cmLinkDirectoriesCommand.cxx')
-rw-r--r-- | Source/cmLinkDirectoriesCommand.cxx | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/Source/cmLinkDirectoriesCommand.cxx b/Source/cmLinkDirectoriesCommand.cxx index 5c52c76..10425fd 100644 --- a/Source/cmLinkDirectoriesCommand.cxx +++ b/Source/cmLinkDirectoriesCommand.cxx @@ -4,6 +4,7 @@ #include <sstream> +#include "cmAlgorithms.h" #include "cmGeneratorExpression.h" #include "cmMakefile.h" #include "cmPolicies.h" @@ -20,13 +21,29 @@ bool cmLinkDirectoriesCommand::InitialPass( return true; } - for (std::string const& i : args) { - this->AddLinkDir(i); + bool before = this->Makefile->IsOn("CMAKE_LINK_DIRECTORIES_BEFORE"); + + auto i = args.cbegin(); + if ((*i) == "BEFORE") { + before = true; + ++i; + } else if ((*i) == "AFTER") { + before = false; + ++i; + } + + std::vector<std::string> directories; + for (; i != args.cend(); ++i) { + this->AddLinkDir(*i, directories); } + + this->Makefile->AddLinkDirectory(cmJoin(directories, ";"), before); + return true; } -void cmLinkDirectoriesCommand::AddLinkDir(std::string const& dir) +void cmLinkDirectoriesCommand::AddLinkDir( + std::string const& dir, std::vector<std::string>& directories) { std::string unixPath = dir; cmSystemTools::ConvertToUnixSlashes(unixPath); @@ -64,5 +81,5 @@ void cmLinkDirectoriesCommand::AddLinkDir(std::string const& dir) unixPath = tmp; } } - this->Makefile->AddLinkDirectory(unixPath); + directories.push_back(unixPath); } |