diff options
author | Brad King <brad.king@kitware.com> | 2020-04-07 12:00:35 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-04-07 12:00:44 (GMT) |
commit | 3d61ff7b1028b00119d4b1388e9fe0fca34499ff (patch) | |
tree | 0527a793a1d0fcec0126b240a16431bb46fb35c6 /Source | |
parent | 3db04c193cb5f9249a0f84d832da5327c4560190 (diff) | |
parent | 35a29ec82790890df4872e60943e9127e4603e54 (diff) | |
download | CMake-3d61ff7b1028b00119d4b1388e9fe0fca34499ff.zip CMake-3d61ff7b1028b00119d4b1388e9fe0fca34499ff.tar.gz CMake-3d61ff7b1028b00119d4b1388e9fe0fca34499ff.tar.bz2 |
Merge topic 'llvm-rc-include-path' into release-3.17
35a29ec827 llvm-rc: Restore include path for data after explicit preprocessing
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4570
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmcmd.cxx | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 2bccbc7..2b8ea24 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -1713,23 +1713,33 @@ int cmcmd::RunLLVMRC(std::vector<std::string> const& args) // The arguments are // args[0] == <cmake-executable> // args[1] == cmake_llvm_rc - // args[2] == intermediate_file - // args[3..n] == preprocess+args + // args[2] == source_file_path + // args[3] == intermediate_file + // args[4..n] == preprocess+args // args[n+1] == -- // args[n+2...] == llvm-rc+args if (args.size() < 3) { std::cerr << "Invalid cmake_llvm_rc arguments"; return 1; } - const std::string& intermediate_file = args[2]; + const std::string& intermediate_file = args[3]; + const std::string& source_file = args[2]; std::vector<std::string> preprocess; std::vector<std::string> resource_compile; std::vector<std::string>* pArgTgt = &preprocess; - for (std::string const& arg : cmMakeRange(args).advance(3)) { + for (std::string const& arg : cmMakeRange(args).advance(4)) { if (arg == "--") { pArgTgt = &resource_compile; } else { - pArgTgt->push_back(arg); + if (arg.find("SOURCE_DIR") != std::string::npos) { + std::string sourceDirArg = arg; + cmSystemTools::ReplaceString( + sourceDirArg, "SOURCE_DIR", + cmSystemTools::GetFilenamePath(source_file)); + pArgTgt->push_back(sourceDirArg); + } else { + pArgTgt->push_back(arg); + } } } if (preprocess.empty()) { |