Commit 8c5221fb authored by Brad King's avatar Brad King
Browse files

try_compile: Preserve special characters in COMPILE_DEFINITIONS

When generating the `CMakeLists.txt` file, we pass the values given
to our `COMPILE_DEFINITIONS` option in an `add_definitions` call.
Pass them as bracket arguments to preserve special characters
like `#`.
parent 15ad8300
......@@ -599,7 +599,9 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
fprintf(fout, "link_directories(${LINK_DIRECTORIES})\n");
// handle any compile flags we need to pass on
if (!compileDefs.empty()) {
fprintf(fout, "add_definitions(%s)\n", cmJoin(compileDefs, " ").c_str());
// Pass using bracket arguments to preserve content.
fprintf(fout, "add_definitions([==[%s]==])\n",
cmJoin(compileDefs, "]==] [==[").c_str());
/* Use a random file name to avoid rapid creation and deletion
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment