summaryrefslogtreecommitdiffstats
path: root/Source/cmCoreTryCompile.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2011-01-20 13:08:47 (GMT)
committerBrad King <brad.king@kitware.com>2011-01-20 13:08:47 (GMT)
commit5792d3a38a67c8e3fffa7e2743a106a87ff7096c (patch)
treea145c39ea070a7d831eece24a6d6d47c2a37a0a3 /Source/cmCoreTryCompile.cxx
parenta5300f1d450daaac7d9a421710141897af304c45 (diff)
downloadCMake-5792d3a38a67c8e3fffa7e2743a106a87ff7096c.zip
CMake-5792d3a38a67c8e3fffa7e2743a106a87ff7096c.tar.gz
CMake-5792d3a38a67c8e3fffa7e2743a106a87ff7096c.tar.bz2
Always place try_compile executables predictably (#11724)
Set CMAKE_RUNTIME_OUTPUT_DIRECTORY explicitly in try_compile projects so that the COPY_FILE feature knows where to look. This makes the feature robust against CMAKE_USER_MAKE_RULES_OVERRIDE files that set variables like CMAKE_RUNTIME_OUTPUT_DIRECTORY or EXECUTABLE_OUTPUT_PATH.
Diffstat (limited to 'Source/cmCoreTryCompile.cxx')
-rw-r--r--Source/cmCoreTryCompile.cxx4
1 files changed, 4 insertions, 0 deletions
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index fcec3e9..1a46df0 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -277,6 +277,10 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
cmakeFlags.push_back(flag);
}
+ /* Put the executable at a known location (for COPY_FILE). */
+ fprintf(fout, "SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"%s\")\n",
+ this->BinaryDirectory.c_str());
+ /* Create the actual executable. */
fprintf(fout, "ADD_EXECUTABLE(cmTryCompileExec \"%s\")\n",source.c_str());
fprintf(fout,
"TARGET_LINK_LIBRARIES(cmTryCompileExec ${LINK_LIBRARIES})\n");