summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/FindArmadillo.cmake1
-rw-r--r--Modules/FindBLAS.cmake1
-rw-r--r--Modules/FindBZip2.cmake4
-rw-r--r--Modules/FindCURL.cmake2
-rw-r--r--Modules/FindEXPAT.cmake2
-rw-r--r--Modules/FindGIF.cmake1
-rw-r--r--Modules/FindGLEW.cmake4
-rw-r--r--Modules/FindIconv.cmake1
-rw-r--r--Modules/FindIntl.cmake2
-rw-r--r--Modules/FindJPEG.cmake4
-rw-r--r--Modules/FindLAPACK.cmake1
-rw-r--r--Modules/FindLibLZMA.cmake4
-rw-r--r--Modules/FindPNG.cmake4
-rw-r--r--Modules/FindProtobuf.cmake2
-rw-r--r--Modules/Platform/Darwin-Initialize.cmake18
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/cpack.cxx2
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx17
-rw-r--r--Source/cmGlobalXCodeGenerator.h1
-rw-r--r--Source/cmSystemTools.cxx6
-rw-r--r--Source/cmSystemTools.h3
-rw-r--r--Tests/RunCMake/CMakeLists.txt4
-rw-r--r--Tests/RunCMake/SymlinkTrees/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/SymlinkTrees/PrintTrees.cmake6
-rw-r--r--Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake34
-rw-r--r--Tests/RunCMake/SymlinkTrees/common_symlinks-stdout.txt4
-rw-r--r--Tests/RunCMake/SymlinkTrees/common_symlinks.cmake1
27 files changed, 106 insertions, 28 deletions
diff --git a/Modules/FindArmadillo.cmake b/Modules/FindArmadillo.cmake
index 243b9e0..c8a31a0 100644
--- a/Modules/FindArmadillo.cmake
+++ b/Modules/FindArmadillo.cmake
@@ -84,6 +84,7 @@ if(_ARMA_USE_WRAPPER)
# Link to the armadillo wrapper library.
find_library(ARMADILLO_LIBRARY
NAMES armadillo
+ NAMES_PER_DIR
PATHS
"$ENV{ProgramFiles}/Armadillo/lib"
"$ENV{ProgramFiles}/Armadillo/lib64"
diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake
index 29871c5..b2df4ad 100644
--- a/Modules/FindBLAS.cmake
+++ b/Modules/FindBLAS.cmake
@@ -208,6 +208,7 @@ macro(CHECK_BLAS_LIBRARIES LIBRARIES _prefix _name _flags _list _threadlibs _add
if(_libraries_work)
find_library(${_prefix}_${_library}_LIBRARY
NAMES ${_library}
+ NAMES_PER_DIR
PATHS ${_extaddlibdir}
PATH_SUFFIXES ${_subdirs}
)
diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake
index 98ab72c..5704d1d 100644
--- a/Modules/FindBZip2.cmake
+++ b/Modules/FindBZip2.cmake
@@ -45,8 +45,8 @@ set(_BZIP2_PATHS PATHS
find_path(BZIP2_INCLUDE_DIR bzlib.h ${_BZIP2_PATHS} PATH_SUFFIXES include)
if (NOT BZIP2_LIBRARIES)
- find_library(BZIP2_LIBRARY_RELEASE NAMES bz2 bzip2 libbz2 libbzip2 ${_BZIP2_PATHS} PATH_SUFFIXES lib)
- find_library(BZIP2_LIBRARY_DEBUG NAMES bz2d bzip2d libbz2d libbzip2d ${_BZIP2_PATHS} PATH_SUFFIXES lib)
+ find_library(BZIP2_LIBRARY_RELEASE NAMES bz2 bzip2 libbz2 libbzip2 NAMES_PER_DIR ${_BZIP2_PATHS} PATH_SUFFIXES lib)
+ find_library(BZIP2_LIBRARY_DEBUG NAMES bz2d bzip2d libbz2d libbzip2d NAMES_PER_DIR ${_BZIP2_PATHS} PATH_SUFFIXES lib)
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
SELECT_LIBRARY_CONFIGURATIONS(BZIP2)
diff --git a/Modules/FindCURL.cmake b/Modules/FindCURL.cmake
index 919babc..3acadc2 100644
--- a/Modules/FindCURL.cmake
+++ b/Modules/FindCURL.cmake
@@ -92,6 +92,7 @@ if(NOT CURL_LIBRARY)
curllib_static
# Windows older "Win32 - MSVC" prebuilts (libcurl.lib, e.g. libcurl-7.15.5-win32-msvc.zip):
libcurl
+ NAMES_PER_DIR
HINTS ${PC_CURL_LIBRARY_DIRS}
)
mark_as_advanced(CURL_LIBRARY_RELEASE)
@@ -100,6 +101,7 @@ if(NOT CURL_LIBRARY)
# Windows MSVC CMake builds in debug configuration on vcpkg:
libcurl-d_imp
libcurl-d
+ NAMES_PER_DIR
HINTS ${PC_CURL_LIBRARY_DIRS}
)
mark_as_advanced(CURL_LIBRARY_DEBUG)
diff --git a/Modules/FindEXPAT.cmake b/Modules/FindEXPAT.cmake
index 15b419a..b0bb02a 100644
--- a/Modules/FindEXPAT.cmake
+++ b/Modules/FindEXPAT.cmake
@@ -38,7 +38,7 @@ pkg_check_modules(PC_EXPAT QUIET expat)
find_path(EXPAT_INCLUDE_DIR NAMES expat.h HINTS ${PC_EXPAT_INCLUDE_DIRS})
# Look for the library.
-find_library(EXPAT_LIBRARY NAMES expat libexpat HINTS ${PC_EXPAT_LIBRARY_DIRS})
+find_library(EXPAT_LIBRARY NAMES expat libexpat NAMES_PER_DIR HINTS ${PC_EXPAT_LIBRARY_DIRS})
if (EXPAT_INCLUDE_DIR AND EXISTS "${EXPAT_INCLUDE_DIR}/expat.h")
file(STRINGS "${EXPAT_INCLUDE_DIR}/expat.h" expat_version_str
diff --git a/Modules/FindGIF.cmake b/Modules/FindGIF.cmake
index d5a143e..cea9cd8 100644
--- a/Modules/FindGIF.cmake
+++ b/Modules/FindGIF.cmake
@@ -60,6 +60,7 @@ set(POTENTIAL_GIF_LIBS gif libgif ungif libungif giflib giflib4)
find_library(GIF_LIBRARY
NAMES ${POTENTIAL_GIF_LIBS}
+ NAMES_PER_DIR
HINTS
ENV GIF_DIR
PATH_SUFFIXES lib
diff --git a/Modules/FindGLEW.cmake b/Modules/FindGLEW.cmake
index 27ffa13..080371a 100644
--- a/Modules/FindGLEW.cmake
+++ b/Modules/FindGLEW.cmake
@@ -139,11 +139,13 @@ __glew_set_find_library_suffix(SHARED)
find_library(GLEW_SHARED_LIBRARY_RELEASE
NAMES GLEW glew glew32
+ NAMES_PER_DIR
PATH_SUFFIXES lib lib64 libx32 lib/Release/${_arch}
PATHS ENV GLEW_ROOT)
find_library(GLEW_SHARED_LIBRARY_DEBUG
NAMES GLEWd glewd glew32d
+ NAMES_PER_DIR
PATH_SUFFIXES lib lib64
PATHS ENV GLEW_ROOT)
@@ -152,11 +154,13 @@ __glew_set_find_library_suffix(STATIC)
find_library(GLEW_STATIC_LIBRARY_RELEASE
NAMES GLEW glew glew32s
+ NAMES_PER_DIR
PATH_SUFFIXES lib lib64 libx32 lib/Release/${_arch}
PATHS ENV GLEW_ROOT)
find_library(GLEW_STATIC_LIBRARY_DEBUG
NAMES GLEWds glewds glew32ds
+ NAMES_PER_DIR
PATH_SUFFIXES lib lib64
PATHS ENV GLEW_ROOT)
diff --git a/Modules/FindIconv.cmake b/Modules/FindIconv.cmake
index bf20f6f..8fd5fba 100644
--- a/Modules/FindIconv.cmake
+++ b/Modules/FindIconv.cmake
@@ -110,6 +110,7 @@ endif()
find_library(Iconv_LIBRARY
NAMES ${Iconv_LIBRARY_NAMES}
+ NAMES_PER_DIR
DOC "iconv library (potentially the C library)")
mark_as_advanced(Iconv_INCLUDE_DIR)
diff --git a/Modules/FindIntl.cmake b/Modules/FindIntl.cmake
index 3818d45..f72837e 100644
--- a/Modules/FindIntl.cmake
+++ b/Modules/FindIntl.cmake
@@ -40,7 +40,7 @@ find_path(Intl_INCLUDE_DIR
mark_as_advanced(Intl_INCLUDE_DIR)
# Find all Intl libraries
-find_library(Intl_LIBRARY "intl"
+find_library(Intl_LIBRARY "intl" NAMES_PER_DIR
DOC "libintl libraries (if not in the C library)")
mark_as_advanced(Intl_LIBRARY)
diff --git a/Modules/FindJPEG.cmake b/Modules/FindJPEG.cmake
index 0bb6989..632fc9a 100644
--- a/Modules/FindJPEG.cmake
+++ b/Modules/FindJPEG.cmake
@@ -58,8 +58,8 @@ foreach(name ${jpeg_names})
endforeach()
if(NOT JPEG_LIBRARY)
- find_library(JPEG_LIBRARY_RELEASE NAMES ${jpeg_names})
- find_library(JPEG_LIBRARY_DEBUG NAMES ${jpeg_names_debug})
+ find_library(JPEG_LIBRARY_RELEASE NAMES ${jpeg_names} NAMES_PER_DIR)
+ find_library(JPEG_LIBRARY_DEBUG NAMES ${jpeg_names_debug} NAMES_PER_DIR)
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
select_library_configurations(JPEG)
mark_as_advanced(JPEG_LIBRARY_RELEASE JPEG_LIBRARY_DEBUG)
diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake
index 01ce074..decc034 100644
--- a/Modules/FindLAPACK.cmake
+++ b/Modules/FindLAPACK.cmake
@@ -162,6 +162,7 @@ macro(CHECK_LAPACK_LIBRARIES LIBRARIES _prefix _name _flags _list _threadlibs _a
if(_libraries_work)
find_library(${_prefix}_${_library}_LIBRARY
NAMES ${_library}
+ NAMES_PER_DIR
PATHS ${_extaddlibdir}
PATH_SUFFIXES ${_subdirs}
)
diff --git a/Modules/FindLibLZMA.cmake b/Modules/FindLibLZMA.cmake
index 200d6bf..4a79a10 100644
--- a/Modules/FindLibLZMA.cmake
+++ b/Modules/FindLibLZMA.cmake
@@ -43,8 +43,8 @@ This module will set the following variables in your project:
find_path(LIBLZMA_INCLUDE_DIR lzma.h )
if(NOT LIBLZMA_LIBRARY)
- find_library(LIBLZMA_LIBRARY_RELEASE NAMES lzma liblzma PATH_SUFFIXES lib)
- find_library(LIBLZMA_LIBRARY_DEBUG NAMES lzmad liblzmad PATH_SUFFIXES lib)
+ find_library(LIBLZMA_LIBRARY_RELEASE NAMES lzma liblzma NAMES_PER_DIR PATH_SUFFIXES lib)
+ find_library(LIBLZMA_LIBRARY_DEBUG NAMES lzmad liblzmad NAMES_PER_DIR PATH_SUFFIXES lib)
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
select_library_configurations(LIBLZMA)
else()
diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake
index f1fe89a..fd0e4e9 100644
--- a/Modules/FindPNG.cmake
+++ b/Modules/FindPNG.cmake
@@ -76,8 +76,8 @@ if(ZLIB_FOUND)
# For compatibility with versions prior to this multi-config search, honor
# any PNG_LIBRARY that is already specified and skip the search.
if(NOT PNG_LIBRARY)
- find_library(PNG_LIBRARY_RELEASE NAMES ${PNG_NAMES})
- find_library(PNG_LIBRARY_DEBUG NAMES ${PNG_NAMES_DEBUG})
+ find_library(PNG_LIBRARY_RELEASE NAMES ${PNG_NAMES} NAMES_PER_DIR)
+ find_library(PNG_LIBRARY_DEBUG NAMES ${PNG_NAMES_DEBUG} NAMES_PER_DIR)
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
select_library_configurations(PNG)
mark_as_advanced(PNG_LIBRARY_RELEASE PNG_LIBRARY_DEBUG)
diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake
index e09717d..f6d8fe3 100644
--- a/Modules/FindProtobuf.cmake
+++ b/Modules/FindProtobuf.cmake
@@ -376,11 +376,13 @@ function(_protobuf_find_libraries name filename)
else()
find_library(${name}_LIBRARY_RELEASE
NAMES ${filename}
+ NAMES_PER_DIR
PATHS ${Protobuf_SRC_ROOT_FOLDER}/vsprojects/${_PROTOBUF_ARCH_DIR}Release)
mark_as_advanced(${name}_LIBRARY_RELEASE)
find_library(${name}_LIBRARY_DEBUG
NAMES ${filename}d ${filename}
+ NAMES_PER_DIR
PATHS ${Protobuf_SRC_ROOT_FOLDER}/vsprojects/${_PROTOBUF_ARCH_DIR}Debug)
mark_as_advanced(${name}_LIBRARY_DEBUG)
diff --git a/Modules/Platform/Darwin-Initialize.cmake b/Modules/Platform/Darwin-Initialize.cmake
index 80e9a40..aa0e554 100644
--- a/Modules/Platform/Darwin-Initialize.cmake
+++ b/Modules/Platform/Darwin-Initialize.cmake
@@ -62,10 +62,10 @@ elseif("${CMAKE_GENERATOR}" MATCHES Xcode
# Find installed SDKs in either Xcode-4.3+ or pre-4.3 SDKs directory.
set(_CMAKE_OSX_SDKS_DIR "")
if(OSX_DEVELOPER_ROOT)
- foreach(d Platforms/MacOSX.platform/Developer/SDKs SDKs)
- file(GLOB _CMAKE_OSX_SDKS ${OSX_DEVELOPER_ROOT}/${d}/*)
+ foreach(_d Platforms/MacOSX.platform/Developer/SDKs SDKs)
+ file(GLOB _CMAKE_OSX_SDKS ${OSX_DEVELOPER_ROOT}/${_d}/*)
if(_CMAKE_OSX_SDKS)
- set(_CMAKE_OSX_SDKS_DIR ${OSX_DEVELOPER_ROOT}/${d})
+ set(_CMAKE_OSX_SDKS_DIR ${OSX_DEVELOPER_ROOT}/${_d})
break()
endif()
endforeach()
@@ -88,10 +88,10 @@ elseif("${CMAKE_GENERATOR}" MATCHES Xcode
# pick an SDK that works
set(_CMAKE_OSX_SYSROOT_DEFAULT)
- foreach(ver ${CMAKE_OSX_DEPLOYMENT_TARGET}
- ${_CURRENT_OSX_VERSION}
- ${_CMAKE_OSX_LATEST_SDK_VERSION})
- set(_CMAKE_OSX_DEPLOYMENT_TARGET ${ver})
+ foreach(_ver ${CMAKE_OSX_DEPLOYMENT_TARGET}
+ ${_CURRENT_OSX_VERSION}
+ ${_CMAKE_OSX_LATEST_SDK_VERSION})
+ set(_CMAKE_OSX_DEPLOYMENT_TARGET ${_ver})
set(_CMAKE_OSX_SDKS_VER ${_CMAKE_OSX_DEPLOYMENT_TARGET}${_CMAKE_OSX_SDKS_VER_SUFFIX_${_CMAKE_OSX_DEPLOYMENT_TARGET}})
set(_CMAKE_OSX_SYSROOT_CHECK "${_CMAKE_OSX_SDKS_DIR}/MacOSX${_CMAKE_OSX_SDKS_VER}.sdk")
if(IS_DIRECTORY "${_CMAKE_OSX_SYSROOT_CHECK}")
@@ -113,8 +113,8 @@ endif()
# Set cache variable - end user may change this during ccmake or cmake-gui configure.
# Choose the type based on the current value.
set(_CMAKE_OSX_SYSROOT_TYPE STRING)
-foreach(v CMAKE_OSX_SYSROOT _CMAKE_OSX_SYSROOT_DEFAULT)
- if("x${${v}}" MATCHES "/")
+foreach(_v CMAKE_OSX_SYSROOT _CMAKE_OSX_SYSROOT_DEFAULT)
+ if("x${${_v}}" MATCHES "/")
set(_CMAKE_OSX_SYSROOT_TYPE PATH)
break()
endif()
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index d91dcdc..66d6285 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,7 +1,7 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 18)
-set(CMake_VERSION_PATCH 20200702)
+set(CMake_VERSION_PATCH 20200703)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 2e5bde2..3a400b7 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -312,7 +312,7 @@ int main(int argc, char const* const* argv)
// The value has not been set on the command line
else {
// get a default value (current working directory)
- cpackProjectDirectory = cmsys::SystemTools::GetCurrentWorkingDirectory();
+ cpackProjectDirectory = cmSystemTools::GetCurrentWorkingDirectory();
// use default value if no value has been provided by the config file
if (!globalMF.IsSet("CPACK_PACKAGE_DIRECTORY")) {
globalMF.AddDefinition("CPACK_PACKAGE_DIRECTORY",
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index bb422eb..074d981 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -468,6 +468,9 @@ void cmGlobalXCodeGenerator::Generate()
}
}
+ // cache the enabled languages for source file type queries
+ this->GetEnabledLanguages(this->EnabledLangs);
+
this->SetGenerationRoot(root);
// now create the project
this->OutputXCodeProject(root, keyVal.second);
@@ -922,9 +925,9 @@ void cmGlobalXCodeGenerator::AddXCodeProjBuildRule(
}
}
-std::string GetSourcecodeValueFromFileExtension(const std::string& _ext,
- const std::string& lang,
- bool& keepLastKnownFileType)
+std::string GetSourcecodeValueFromFileExtension(
+ const std::string& _ext, const std::string& lang,
+ bool& keepLastKnownFileType, const std::vector<std::string>& enabled_langs)
{
std::string ext = cmSystemTools::LowerCase(_ext);
std::string sourcecode = "sourcecode";
@@ -939,9 +942,9 @@ std::string GetSourcecodeValueFromFileExtension(const std::string& _ext,
} else if (ext == "storyboard") {
keepLastKnownFileType = true;
sourcecode = "file.storyboard";
- } else if (ext == "mm") {
+ } else if (ext == "mm" && !cm::contains(enabled_langs, "OBJCXX")) {
sourcecode += ".cpp.objcpp";
- } else if (ext == "m") {
+ } else if (ext == "m" && !cm::contains(enabled_langs, "OBJC")) {
sourcecode += ".c.objc";
} else if (ext == "swift") {
sourcecode += ".swift";
@@ -1028,8 +1031,8 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeFileReferenceFromPath(
fileType = (ext == "xcassets" ? "folder.assetcatalog" : "folder");
useLastKnownFileType = true;
} else {
- fileType =
- GetSourcecodeValueFromFileExtension(ext, lang, useLastKnownFileType);
+ fileType = GetSourcecodeValueFromFileExtension(
+ ext, lang, useLastKnownFileType, this->EnabledLangs);
}
}
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index 0fc6558..11b9312 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -301,6 +301,7 @@ private:
std::string ObjectDirArch;
std::string GeneratorToolset;
std::map<cmGeneratorTarget const*, size_t> TargetOrderIndex;
+ std::vector<std::string> EnabledLangs;
};
#endif
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 2f08b84..1e78d36 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -2082,6 +2082,12 @@ std::string const& cmSystemTools::GetCMakeRoot()
return cmSystemToolsCMakeRoot;
}
+std::string cmSystemTools::GetCurrentWorkingDirectory()
+{
+ return cmSystemTools::CollapseFullPath(
+ cmsys::SystemTools::GetCurrentWorkingDirectory());
+}
+
void cmSystemTools::MakefileColorEcho(int color, const char* message,
bool newline, bool enabled)
{
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index ee149a0..b886c58 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -390,6 +390,9 @@ public:
static std::string const& GetCMClDepsCommand();
static std::string const& GetCMakeRoot();
+ /** Get the CWD mapped through the KWSys translation map. */
+ static std::string GetCurrentWorkingDirectory();
+
/** Echo a message in color using KWSys's Terminal cprintf. */
static void MakefileColorEcho(int color, const char* message, bool newLine,
bool enabled);
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index fc337df..871e18f 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -436,6 +436,10 @@ else()
message(STATUS "Could not find ctresalloc")
endif()
+if(NOT WIN32)
+ add_RunCMake_test(SymlinkTrees)
+endif ()
+
find_package(Qt4 QUIET)
find_package(Qt5Core QUIET)
if (QT4_FOUND AND Qt5Core_FOUND AND NOT Qt5Core_VERSION VERSION_LESS 5.1.0)
diff --git a/Tests/RunCMake/SymlinkTrees/CMakeLists.txt b/Tests/RunCMake/SymlinkTrees/CMakeLists.txt
new file mode 100644
index 0000000..d6fea2c
--- /dev/null
+++ b/Tests/RunCMake/SymlinkTrees/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8.12)
+project(${RunCMake_TEST} NONE)
+include("${include_dir}/${RunCMake_TEST}.cmake")
diff --git a/Tests/RunCMake/SymlinkTrees/PrintTrees.cmake b/Tests/RunCMake/SymlinkTrees/PrintTrees.cmake
new file mode 100644
index 0000000..aa99127
--- /dev/null
+++ b/Tests/RunCMake/SymlinkTrees/PrintTrees.cmake
@@ -0,0 +1,6 @@
+message(STATUS "source: '${CMAKE_SOURCE_DIR}'")
+message(STATUS "binary: '${CMAKE_BINARY_DIR}'")
+get_filename_component(real_source "${CMAKE_SOURCE_DIR}" REALPATH)
+get_filename_component(real_binary "${CMAKE_BINARY_DIR}" REALPATH)
+message(STATUS "real source: '${real_source}'")
+message(STATUS "real binary: '${real_binary}'")
diff --git a/Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake b/Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake
new file mode 100644
index 0000000..e5f1f7f
--- /dev/null
+++ b/Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake
@@ -0,0 +1,34 @@
+include(RunCMake)
+
+# This function assumes that ``${RunCMake_BINARY_DIR}/${name}/source`` and
+# ``${RunCMake_BINARY_DIR}/${name}/binary`` are set up properly prior to
+# calling it.
+function (run_symlink_test name)
+ set(RunCMake_TEST_NO_CLEAN TRUE)
+ configure_file(
+ "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt"
+ "${RunCMake_BINARY_DIR}/${name}/source/CMakeLists.txt"
+ COPYONLY)
+ set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/${name}/source")
+ set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${name}/binary")
+ # Emulate a shell using this directory.
+ set(ENV{PWD} "${RunCMake_TEST_BINARY_DIR}")
+ set(RunCMake_TEST_OPTIONS
+ "-Dinclude_dir:PATH=${CMAKE_CURRENT_LIST_DIR}")
+ run_cmake("${name}_symlinks")
+endfunction ()
+
+# Create the following structure:
+#
+# .../common_real/source
+# .../common_real/binary
+# .../common -> common_real
+#
+# In this case, CMake should act as if .../common *is* .../common_real for all
+# computations except ``REALPATH``. This supports the case where a system has
+# a stable *symlink*, but not a stable target for that symlink.
+file(REMOVE_RECURSE "${RunCMake_BINARY_DIR}/common_real")
+file(REMOVE "${RunCMake_BINARY_DIR}/common")
+file(MAKE_DIRECTORY "${RunCMake_BINARY_DIR}/common_real/source")
+file(CREATE_LINK "common_real" "${RunCMake_BINARY_DIR}/common" SYMBOLIC)
+run_symlink_test(common)
diff --git a/Tests/RunCMake/SymlinkTrees/common_symlinks-stdout.txt b/Tests/RunCMake/SymlinkTrees/common_symlinks-stdout.txt
new file mode 100644
index 0000000..bb04450
--- /dev/null
+++ b/Tests/RunCMake/SymlinkTrees/common_symlinks-stdout.txt
@@ -0,0 +1,4 @@
+-- source: '[^']*/Tests/RunCMake/SymlinkTrees/common/source'
+-- binary: '[^']*/Tests/RunCMake/SymlinkTrees/common/binary'
+-- real source: '[^']*/Tests/RunCMake/SymlinkTrees/common_real/source'
+-- real binary: '[^']*/Tests/RunCMake/SymlinkTrees/common_real/binary'
diff --git a/Tests/RunCMake/SymlinkTrees/common_symlinks.cmake b/Tests/RunCMake/SymlinkTrees/common_symlinks.cmake
new file mode 100644
index 0000000..5eafe26
--- /dev/null
+++ b/Tests/RunCMake/SymlinkTrees/common_symlinks.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_LIST_DIR}/PrintTrees.cmake")