diff options
author | Brad King <brad.king@kitware.com> | 2019-03-26 14:56:27 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-03-26 14:56:34 (GMT) |
commit | 8494bc271399cf4e474f640fde08e6cd61d932da (patch) | |
tree | e573849e5ab99a0f5a013032332c25421a7a2e5f /Source/cmCoreTryCompile.cxx | |
parent | db20cb2f9f2ff1d00593e0fc921184d99f58749a (diff) | |
parent | 588fa1bb9eed6e838f58d4f1fb1d01d83ecfd820 (diff) | |
download | CMake-8494bc271399cf4e474f640fde08e6cd61d932da.zip CMake-8494bc271399cf4e474f640fde08e6cd61d932da.tar.gz CMake-8494bc271399cf4e474f640fde08e6cd61d932da.tar.bz2 |
Merge topic 'toolchain-include_directories'
588fa1bb9e Restore support for include_directories() in toolchain files
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3140
Diffstat (limited to 'Source/cmCoreTryCompile.cxx')
-rw-r--r-- | Source/cmCoreTryCompile.cxx | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 69d4374..ffc41ba 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -123,6 +123,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv, std::string targetName; std::vector<std::string> cmakeFlags(1, "CMAKE_FLAGS"); // fake argv[0] std::vector<std::string> compileDefs; + std::string cmakeInternal; std::string outputVariable; std::string copyFile; std::string copyFileError; @@ -174,7 +175,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv, DoingCExtensions, DoingCxxExtensions, DoingCudaExtensions, - DoingSources + DoingSources, + DoingCMakeInternal }; Doing doing = useSources ? DoingSources : DoingNone; for (size_t i = 3; i < argv.size(); ++i) { @@ -223,6 +225,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv, } else if (argv[i] == "CUDA_EXTENSIONS") { doing = DoingCudaExtensions; didCudaExtensions = true; + } else if (argv[i] == "__CMAKE_INTERNAL") { + doing = DoingCMakeInternal; } else if (doing == DoingCMakeFlags) { cmakeFlags.push_back(argv[i]); } else if (doing == DoingCompileDefinitions) { @@ -296,6 +300,9 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv, doing = DoingNone; } else if (doing == DoingSources) { sources.push_back(argv[i]); + } else if (doing == DoingCMakeInternal) { + cmakeInternal = argv[i]; + doing = DoingNone; } else if (i == 3) { this->SrcFileSignature = false; projectName = argv[i].c_str(); @@ -508,6 +515,14 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv, } } fprintf(fout, "project(CMAKE_TRY_COMPILE%s)\n", projectLangs.c_str()); + if (cmakeInternal == "ABI") { + // This is the ABI detection step, also used for implicit includes. + // Erase any include_directories() calls from the toolchain file so + // that we do not see them as implicit. Our ABI detection source + // does not include any system headers anyway. + fprintf(fout, + "set_property(DIRECTORY PROPERTY INCLUDE_DIRECTORIES \"\")\n"); + } fprintf(fout, "set(CMAKE_VERBOSE_MAKEFILE 1)\n"); for (std::string const& li : testLangs) { std::string langFlags = "CMAKE_" + li + "_FLAGS"; |