FindPackageMessage: Eliminate new lines in cache entries

Fix problem exposed by recent commit to FindPythonInterp.
If the find "details" has new lines in it, then replace them
with literal "\n" two character sequences so that the string
may be saved as a cache entry that can be re-read next time
CMake runs.
This commit is contained in:
David Cole 2011-08-24 14:06:51 -04:00
parent 29b285c6a1
commit 0ae78b76d5
1 changed files with 1 additions and 0 deletions

View File

@ -34,6 +34,7 @@
FUNCTION(FIND_PACKAGE_MESSAGE pkg msg details) FUNCTION(FIND_PACKAGE_MESSAGE pkg msg details)
# Avoid printing a message repeatedly for the same find result. # Avoid printing a message repeatedly for the same find result.
IF(NOT ${pkg}_FIND_QUIETLY) IF(NOT ${pkg}_FIND_QUIETLY)
STRING(REPLACE "\n" "\\n" details "${details}")
SET(DETAILS_VAR FIND_PACKAGE_MESSAGE_DETAILS_${pkg}) SET(DETAILS_VAR FIND_PACKAGE_MESSAGE_DETAILS_${pkg})
IF(NOT "${details}" STREQUAL "${${DETAILS_VAR}}") IF(NOT "${details}" STREQUAL "${${DETAILS_VAR}}")
# The message has not yet been printed. # The message has not yet been printed.