summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt11
-rw-r--r--Help/manual/cmake-variables.7.rst1
-rw-r--r--Help/policy/CMP0022.rst4
-rw-r--r--Help/variable/CMAKE_SKIP_INSTALL_RULES.rst7
-rw-r--r--Modules/CMakeExpandImportedTargets.cmake9
-rw-r--r--Modules/CMakePrintHelpers.cmake9
-rw-r--r--Modules/CPackWIX.cmake11
-rw-r--r--Modules/CheckStructHasMember.cmake7
-rw-r--r--Modules/FindQt4.cmake7
-rw-r--r--Modules/GNUInstallDirs.cmake2
-rw-r--r--Modules/UseJava.cmake31
-rw-r--r--Modules/UseSWIG.cmake6
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.cxx43
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.h3
-rw-r--r--Source/cmGlobalGenerator.cxx15
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx5
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx4
-rw-r--r--Tests/CMakeLists.txt13
-rw-r--r--Tests/MissingInstall/CMakeLists.txt25
-rw-r--r--Tests/MissingInstall/ExpectInstallFail.cmake18
-rw-r--r--Tests/MissingInstall/mybin.cpp1
-rw-r--r--Tests/RunCMake/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/CMakeLists.txt.orig142
-rw-r--r--Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt5
-rw-r--r--Tests/RunCMake/install/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/install/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/install/SkipInstallRulesNoWarning1-check.cmake9
-rw-r--r--Tests/RunCMake/install/SkipInstallRulesNoWarning1-stderr.txt1
-rw-r--r--Tests/RunCMake/install/SkipInstallRulesNoWarning1.cmake1
-rw-r--r--Tests/RunCMake/install/SkipInstallRulesNoWarning2-check.cmake9
-rw-r--r--Tests/RunCMake/install/SkipInstallRulesNoWarning2-stderr.txt1
-rw-r--r--Tests/RunCMake/install/SkipInstallRulesNoWarning2.cmake1
-rw-r--r--Tests/RunCMake/install/SkipInstallRulesWarning-check.cmake9
-rw-r--r--Tests/RunCMake/install/SkipInstallRulesWarning-stderr.txt3
-rw-r--r--Tests/RunCMake/install/SkipInstallRulesWarning.cmake2
36 files changed, 363 insertions, 63 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a13afa1..761ad20 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -589,14 +589,3 @@ install(
# Install auxiliary files integrating with other tools.
add_subdirectory(Auxiliary)
-
-#-----------------------------------------------------------------------
-# End of the main section of the CMakeLists file
-#-----------------------------------------------------------------------
-
-# As a special case when building CMake itself, CMake 2.8.0 and below
-# look up EXECUTABLE_OUTPUT_PATH in the top-level CMakeLists.txt file
-# to compute the location of the "cmake" executable. We set it here
-# so that those CMake versions can find it. We wait until after all
-# the add_subdirectory() calls to avoid affecting the subdirectories.
-set(EXECUTABLE_OUTPUT_PATH ${CMake_BIN_DIR})
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index aebfe87..cdd996c 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -59,6 +59,7 @@ Variables that Provide Information
/variable/CMAKE_SHARED_MODULE_PREFIX
/variable/CMAKE_SHARED_MODULE_SUFFIX
/variable/CMAKE_SIZEOF_VOID_P
+ /variable/CMAKE_SKIP_INSTALL_RULES
/variable/CMAKE_SKIP_RPATH
/variable/CMAKE_SOURCE_DIR
/variable/CMAKE_STANDARD_LIBRARIES
diff --git a/Help/policy/CMP0022.rst b/Help/policy/CMP0022.rst
index d068c55..16a5bc3 100644
--- a/Help/policy/CMP0022.rst
+++ b/Help/policy/CMP0022.rst
@@ -22,6 +22,10 @@ downstream users of CMake versions older than 2.8.12. The
target_link_libraries command will no longer populate the properties
matching LINK_INTERFACE_LIBRARIES(_<CONFIG>)? if this policy is NEW.
+Warning-free future-compatible code which works with CMake 2.8.9 onwards
+can be written by using the ``LINK_PRIVATE`` and ``LINK_PUBLIC`` keywords
+of :command:`target_link_libraries`.
+
The OLD behavior for this policy is to ignore the
INTERFACE_LINK_LIBRARIES property for in-build targets. The NEW
behavior for this policy is to use the INTERFACE_LINK_LIBRARIES
diff --git a/Help/variable/CMAKE_SKIP_INSTALL_RULES.rst b/Help/variable/CMAKE_SKIP_INSTALL_RULES.rst
new file mode 100644
index 0000000..5eda254
--- /dev/null
+++ b/Help/variable/CMAKE_SKIP_INSTALL_RULES.rst
@@ -0,0 +1,7 @@
+CMAKE_SKIP_INSTALL_RULES
+------------------------
+
+Whether to disable generation of installation rules.
+
+If TRUE, cmake will neither generate installaton rules nor
+will it generate cmake_install.cmake files. This variable is FALSE by default.
diff --git a/Modules/CMakeExpandImportedTargets.cmake b/Modules/CMakeExpandImportedTargets.cmake
index 47ac316..0752e04 100644
--- a/Modules/CMakeExpandImportedTargets.cmake
+++ b/Modules/CMakeExpandImportedTargets.cmake
@@ -2,15 +2,10 @@
# CMakeExpandImportedTargets
# --------------------------
#
-#
-#
-# CMAKE_EXPAND_IMPORTED_TARGETS(<var> LIBRARIES lib1 lib2...libN
-#
# ::
#
-# [CONFIGURATION <config>] )
-#
-#
+# CMAKE_EXPAND_IMPORTED_TARGETS(<var> LIBRARIES lib1 lib2...libN
+# [CONFIGURATION <config>])
#
# CMAKE_EXPAND_IMPORTED_TARGETS() takes a list of libraries and replaces
# all imported targets contained in this list with their actual file
diff --git a/Modules/CMakePrintHelpers.cmake b/Modules/CMakePrintHelpers.cmake
index 72832ad..ad3b0d5 100644
--- a/Modules/CMakePrintHelpers.cmake
+++ b/Modules/CMakePrintHelpers.cmake
@@ -4,22 +4,15 @@
#
# Convenience macros for printing properties and variables, useful e.g. for debugging.
#
-#
-#
-#
-#
-# CMAKE_PRINT_PROPERTIES([TARGETS target1 .. targetN]
-#
# ::
#
+# CMAKE_PRINT_PROPERTIES([TARGETS target1 .. targetN]
# [SOURCES source1 .. sourceN]
# [DIRECTORIES dir1 .. dirN]
# [TESTS test1 .. testN]
# [CACHE_ENTRIES entry1 .. entryN]
# PROPERTIES prop1 .. propN )
#
-#
-#
# This macro prints the values of the properties of the given targets,
# source files, directories, tests or cache entries. Exactly one of the
# scope keywords must be used. Example:
diff --git a/Modules/CPackWIX.cmake b/Modules/CPackWIX.cmake
index 30f57c7..39183c6 100644
--- a/Modules/CPackWIX.cmake
+++ b/Modules/CPackWIX.cmake
@@ -205,6 +205,17 @@
#
# ``<TOOL>`` can be either LIGHT or CANDLE.
#
+# .. variable:: CPACK_WIX_CMAKE_PACKAGE_REGISTRY
+#
+# If this variable is set the generated installer will create
+# an entry in the windows registry key
+# ``HKEY_LOCAL_MACHINE\Software\Kitware\CMake\Packages\<package>``
+# The value for ``<package>`` is provided by this variable.
+#
+# Assuming you also install a CMake configuration file this will
+# allow other CMake projects to find your package with
+# the :command:`find_package` command.
+#
#=============================================================================
# Copyright 2013 Kitware, Inc.
diff --git a/Modules/CheckStructHasMember.cmake b/Modules/CheckStructHasMember.cmake
index a4ed8d5..a864e82 100644
--- a/Modules/CheckStructHasMember.cmake
+++ b/Modules/CheckStructHasMember.cmake
@@ -4,13 +4,10 @@
#
# Check if the given struct or class has the specified member variable
#
-# CHECK_STRUCT_HAS_MEMBER (<struct> <member> <header> <variable>
-#
# ::
#
-# [LANGUAGE <language>])
-#
-#
+# CHECK_STRUCT_HAS_MEMBER(<struct> <member> <header> <variable>
+# [LANGUAGE <language>])
#
# ::
#
diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake
index 03924fa..46a893d 100644
--- a/Modules/FindQt4.cmake
+++ b/Modules/FindQt4.cmake
@@ -761,7 +761,8 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
set(QT_MKSPECS_DIR NOTFOUND)
find_path(QT_MKSPECS_DIR NAMES qconfig.pri
HINTS ${qt_cross_paths} ${qt_mkspecs_dirs}
- DOC "The location of the Qt mkspecs containing qconfig.pri")
+ DOC "The location of the Qt mkspecs containing qconfig.pri"
+ NO_CMAKE_FIND_ROOT_PATH)
endif()
if(EXISTS "${QT_MKSPECS_DIR}/qconfig.pri")
@@ -917,7 +918,8 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
endforeach()
find_path(QT_PLUGINS_DIR NAMES accessible imageformats sqldrivers codecs designer
HINTS ${qt_cross_paths} ${qt_plugins_dir}
- DOC "The location of the Qt plugins")
+ DOC "The location of the Qt plugins"
+ NO_CMAKE_FIND_ROOT_PATH)
endif ()
# ask qmake for the translations directory
@@ -937,6 +939,7 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
find_path(QT_IMPORTS_DIR NAMES Qt
HINTS ${qt_cross_paths} ${qt_imports_dir}
DOC "The location of the Qt imports"
+ NO_CMAKE_FIND_ROOT_PATH
NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH)
mark_as_advanced(QT_IMPORTS_DIR)
diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake
index c8d77c6..9f5b8a4 100644
--- a/Modules/GNUInstallDirs.cmake
+++ b/Modules/GNUInstallDirs.cmake
@@ -95,7 +95,7 @@ if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
# For Debian with multiarch, use 'lib/${CMAKE_LIBRARY_ARCHITECTURE}' if
# CMAKE_LIBRARY_ARCHITECTURE is set (which contains e.g. "i386-linux-gnu"
# See http://wiki.debian.org/Multiarch
- if(CMAKE_SYSTEM_NAME MATCHES "Linux"
+ if(CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$"
AND NOT CMAKE_CROSSCOMPILING)
if (EXISTS "/etc/debian_version") # is this a debian system ?
if(CMAKE_LIBRARY_ARCHITECTURE)
diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake
index f7f242b..654b4d0 100644
--- a/Modules/UseJava.cmake
+++ b/Modules/UseJava.cmake
@@ -8,19 +8,16 @@
# FindJava.cmake has already been loaded. See FindJava.cmake for
# information on how to load Java into your CMake project.
#
-# add_jar(target_name
-#
# ::
#
+# add_jar(target_name
# [SOURCES] source1 [source2 ...] [resource1 ...]
# [INCLUDE_JARS jar1 [jar2 ...]]
# [ENTRY_POINT entry]
# [VERSION version]
# [OUTPUT_NAME name]
# [OUTPUT_DIR dir]
-# )
-#
-#
+# )
#
# This command creates a <target_name>.jar. It compiles the given
# source files (source) and adds the given resource files (resource) to
@@ -189,19 +186,14 @@
# CLASS_DIR The directory where the class files can be found. For
# example to use them with javah.
#
-#
-#
-# find_jar(<VAR>
-#
# ::
#
+# find_jar(<VAR>
# name | NAMES name1 [name2 ...]
# [PATHS path1 [path2 ... ENV var]]
# [VERSIONS version1 [version2]]
# [DOC "cache documentation string"]
-# )
-#
-#
+# )
#
# This command is used to find a full path to the named jar. A cache
# entry named by <VAR> is created to stor the result of this command.
@@ -216,21 +208,24 @@
# the VERSIONS argument. The argument after DOC will be used for the
# documentation string in the cache.
#
-# install_jar(TARGET_NAME DESTINATION)
+# ::
+#
+# install_jar(TARGET_NAME DESTINATION)
#
# This command installs the TARGET_NAME files to the given DESTINATION.
# It should be called in the same scope as add_jar() or it will fail.
#
-# install_jni_symlink(TARGET_NAME DESTINATION)
+# ::
+#
+# install_jni_symlink(TARGET_NAME DESTINATION)
#
# This command installs the TARGET_NAME JNI symlinks to the given
# DESTINATION. It should be called in the same scope as add_jar() or it
# will fail.
#
-# create_javadoc(<VAR>
-#
# ::
#
+# create_javadoc(<VAR>
# PACKAGES pkg1 [pkg2 ...]
# [SOURCEPATH <sourcepath>]
# [CLASSPATH <classpath>]
@@ -240,9 +235,7 @@
# [AUTHOR TRUE|FALSE]
# [USE TRUE|FALSE]
# [VERSION TRUE|FALSE]
-# )
-#
-#
+# )
#
# Create java documentation based on files or packages. For more
# details please read the javadoc manpage.
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
index 67cab4a..11ca205 100644
--- a/Modules/UseSWIG.cmake
+++ b/Modules/UseSWIG.cmake
@@ -22,11 +22,9 @@
# swig generated module (swig -outdir option) The name-specific variable
# SWIG_MODULE_<name>_EXTRA_DEPS may be used to specify extra
# dependencies for the generated modules. If the source file generated
-# by swig need some special flag you can use
-# set_source_files_properties( ${swig_generated_file_fullname}
-#
-# ::
+# by swig need some special flag you can use::
#
+# set_source_files_properties( ${swig_generated_file_fullname}
# PROPERTIES COMPILE_FLAGS "-bla")
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 90d311c..08ff713 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -2,5 +2,5 @@
set(CMake_VERSION_MAJOR 2)
set(CMake_VERSION_MINOR 8)
set(CMake_VERSION_PATCH 12)
-set(CMake_VERSION_TWEAK 20140107)
+set(CMake_VERSION_TWEAK 20140109)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
index a55a6a6..998b5f1 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
@@ -437,7 +437,15 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
featureDefinitions.AddAttribute("Level", "1");
- CreateFeatureHierarchy(featureDefinitions);
+ if(!CreateCMakePackageRegistryEntry(featureDefinitions))
+ {
+ return false;
+ }
+
+ if(!CreateFeatureHierarchy(featureDefinitions))
+ {
+ return false;
+ }
featureDefinitions.EndElement("Feature");
@@ -564,6 +572,39 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
return true;
}
+bool cmCPackWIXGenerator::CreateCMakePackageRegistryEntry(
+ cmWIXSourceWriter& featureDefinitions)
+{
+ const char* package = GetOption("CPACK_WIX_CMAKE_PACKAGE_REGISTRY");
+ if(!package)
+ {
+ return true;
+ }
+
+ featureDefinitions.BeginElement("Component");
+ featureDefinitions.AddAttribute("Id", "CM_PACKAGE_REGISTRY");
+ featureDefinitions.AddAttribute("Directory", "TARGETDIR");
+ featureDefinitions.AddAttribute("Guid", "*");
+
+ std::string registryKey =
+ std::string("Software\\Kitware\\CMake\\Packages\\") + package;
+
+ std::string upgradeGuid = GetOption("CPACK_WIX_UPGRADE_GUID");
+
+ featureDefinitions.BeginElement("RegistryValue");
+ featureDefinitions.AddAttribute("Root", "HKLM");
+ featureDefinitions.AddAttribute("Key", registryKey);
+ featureDefinitions.AddAttribute("Name", upgradeGuid);
+ featureDefinitions.AddAttribute("Type", "string");
+ featureDefinitions.AddAttribute("Value", "[INSTALL_ROOT]");
+ featureDefinitions.AddAttribute("KeyPath", "yes");
+ featureDefinitions.EndElement("RegistryValue");
+
+ featureDefinitions.EndElement("Component");
+
+ return true;
+}
+
bool cmCPackWIXGenerator::CreateFeatureHierarchy(
cmWIXSourceWriter& featureDefinitions)
{
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.h b/Source/CPack/WiX/cmCPackWIXGenerator.h
index 0a85ae2..1f4facf 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.h
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.h
@@ -81,6 +81,9 @@ private:
bool CreateWiXSourceFiles();
+ bool CreateCMakePackageRegistryEntry(
+ cmWIXSourceWriter& featureDefinitions);
+
bool CreateFeatureHierarchy(
cmWIXSourceWriter& featureDefinitions);
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index c43fd91..1c4488f 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1183,7 +1183,11 @@ void cmGlobalGenerator::Generate()
this->LocalGenerators[i]->GetMakefile()->SetGeneratingBuildSystem();
this->SetCurrentLocalGenerator(this->LocalGenerators[i]);
this->LocalGenerators[i]->Generate();
- this->LocalGenerators[i]->GenerateInstallRules();
+ if(!this->LocalGenerators[i]->GetMakefile()->IsOn(
+ "CMAKE_SKIP_INSTALL_RULES"))
+ {
+ this->LocalGenerators[i]->GenerateInstallRules();
+ }
this->LocalGenerators[i]->GenerateTestFiles();
this->CMakeInstance->UpdateProgress("Generating",
(static_cast<float>(i)+1.0f)/
@@ -2276,7 +2280,14 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
}
//Install
- if(this->InstallTargetEnabled)
+ bool skipInstallRules = mf->IsOn("CMAKE_SKIP_INSTALL_RULES");
+ if(this->InstallTargetEnabled && skipInstallRules)
+ {
+ mf->IssueMessage(cmake::WARNING,
+ "CMAKE_SKIP_INSTALL_RULES was enabled even though "
+ "installation rules have been specified");
+ }
+ else if(this->InstallTargetEnabled && !skipInstallRules)
{
if(!cmakeCfgIntDir || !*cmakeCfgIntDir || cmakeCfgIntDir[0] == '.')
{
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 381c1f5..eef49db 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -876,7 +876,10 @@ cmGlobalXCodeGenerator::CreateXCodeFileReferenceFromPath(
else
{
std::string sourcecode = GetSourcecodeValueFromFileExtension(ext, lang);
- fileRef->AddAttribute("explicitFileType",
+ const char* attribute = (sourcecode == "file.storyboard") ?
+ "lastKnownFileType" :
+ "explicitFileType";
+ fileRef->AddAttribute(attribute,
this->CreateString(sourcecode.c_str()));
}
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 784cadb..0434506 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1425,7 +1425,9 @@ OutputIncludes(std::vector<std::string> const & includes)
for(std::vector<std::string>::const_iterator i = includes.begin();
i != includes.end(); ++i)
{
- *this->BuildFileStream << cmVS10EscapeXML(*i) << ";";
+ std::string incDir = *i;
+ this->ConvertToWindowsSlash(incDir);
+ *this->BuildFileStream << cmVS10EscapeXML(incDir) << ";";
}
this->WriteString("%(AdditionalIncludeDirectories)"
"</AdditionalIncludeDirectories>\n", 0);
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 78dddd3..7969078 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -742,6 +742,19 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--test-command ${SimpleInstallInstallDir}/MyTest/bin/SimpleInstExeS2)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SimpleInstallS2")
+ set(MissingInstallInstallDir
+ "${CMake_BINARY_DIR}/Tests/MissingInstall/InstallDirectory")
+ add_test(MissingInstall ${CMAKE_CTEST_COMMAND}
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/MissingInstall"
+ "${CMake_BINARY_DIR}/Tests/MissingInstall"
+ ${build_generator_args}
+ --build-project TestMissingInstall
+ --build-two-config
+ --build-options ${build_options}
+ "-DCMAKE_INSTALL_PREFIX:PATH=${MissingInstallInstallDir}")
+ list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/MissingInstall")
+
# By default, run the CPackComponents test if the CTEST_TEST_CPACK
# option is ON:
#
diff --git a/Tests/MissingInstall/CMakeLists.txt b/Tests/MissingInstall/CMakeLists.txt
new file mode 100644
index 0000000..91624f7
--- /dev/null
+++ b/Tests/MissingInstall/CMakeLists.txt
@@ -0,0 +1,25 @@
+cmake_minimum_required (VERSION 2.8.12)
+project(TestMissingInstall)
+
+set(CMAKE_SKIP_INSTALL_RULES ON)
+
+# Skip the dependency that causes a build when installing. This
+# avoids infinite loops when the post-build rule below installs.
+set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY 1)
+set(CMAKE_SKIP_PACKAGE_ALL_DEPENDENCY 1)
+
+if(CMAKE_CONFIGURATION_TYPES)
+ set(MULTI_CONFIG ON)
+else()
+ set(MULTI_CONFIG OFF)
+endif()
+
+add_executable(mybin mybin.cpp)
+install(TARGETS mybin RUNTIME DESTINATION bin)
+
+add_custom_command(TARGET mybin
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} "-DMULTI_CONFIG=${MULTI_CONFIG}"
+ -P ${CMAKE_CURRENT_SOURCE_DIR}/ExpectInstallFail.cmake
+ COMMENT "Install Project"
+)
diff --git a/Tests/MissingInstall/ExpectInstallFail.cmake b/Tests/MissingInstall/ExpectInstallFail.cmake
new file mode 100644
index 0000000..3d677bf
--- /dev/null
+++ b/Tests/MissingInstall/ExpectInstallFail.cmake
@@ -0,0 +1,18 @@
+if(MULTI_CONFIG)
+ set(SI_CONFIG --config $<CONFIGURATION>)
+else()
+ set(SI_CONFIG)
+endif()
+
+execute_process(
+ COMMAND ${CMAKE_COMMAND}
+ --build .
+ --target install ${SI_CONFIG}
+ RESULT_VARIABLE RESULT
+ OUTPUT_VARIABLE OUTPUT
+ ERROR_VARIABLE ERROR
+)
+
+if(RESULT EQUAL 0)
+ message(FATAL_ERROR "install should have failed")
+endif()
diff --git a/Tests/MissingInstall/mybin.cpp b/Tests/MissingInstall/mybin.cpp
new file mode 100644
index 0000000..237c8ce
--- /dev/null
+++ b/Tests/MissingInstall/mybin.cpp
@@ -0,0 +1 @@
+int main() {}
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 944b898..77700d7 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -145,3 +145,5 @@ add_RunCMake_test(File_Generate)
add_RunCMake_test(ExportWithoutLanguage)
add_RunCMake_test(target_link_libraries)
add_RunCMake_test(CheckModules)
+
+add_RunCMake_test(install)
diff --git a/Tests/RunCMake/CMakeLists.txt.orig b/Tests/RunCMake/CMakeLists.txt.orig
new file mode 100644
index 0000000..96b0543
--- /dev/null
+++ b/Tests/RunCMake/CMakeLists.txt.orig
@@ -0,0 +1,142 @@
+# This directory contains tests that run CMake to configure a project
+# but do not actually build anything. To add a test:
+#
+# 1.) Add a subdirectory named for the test.
+#
+# 2.) Call add_RunCMake_test and pass the test directory name.
+#
+# 3.) Create a RunCMakeTest.cmake script in the directory containing
+# include(RunCMake)
+# run_cmake(SubTest1)
+# ...
+# run_cmake(SubTestN)
+# where SubTest1..SubTestN are sub-test names each corresponding to
+# an independent CMake run and project configuration.
+#
+# 3.) Create a CMakeLists.txt file in the directory containing
+# cmake_minimum_required(...)
+# project(${RunCMake_TEST} NONE) # or languages needed
+# include(${RunCMake_TEST}.cmake)
+# where "${RunCMake_TEST}" is literal. A value for RunCMake_TEST
+# will be passed to CMake by the run_cmake macro when running each
+# sub-test.
+#
+# 4.) Create a <SubTest>.cmake file for each sub-test named above
+# containing the actual test code. Optionally create files
+# containing expected test results:
+# <SubTest>-result.txt = Process result expected if not "0"
+# <SubTest>-stdout.txt = Regex matching expected stdout content
+# <SubTest>-stderr.txt = Regex matching expected stderr content
+# <SubTest>-check.cmake = Custom result check
+# Note that trailing newlines will be stripped from actual and expected test
+# output before matching against the stdout and stderr expressions.
+# The code in <SubTest>-check.cmake may use variables
+# RunCMake_TEST_SOURCE_DIR = Top of test source tree
+# RunCMake_TEST_BINARY_DIR = Top of test binary tree
+# and an failure must store a message in RunCMake_TEST_FAILED.
+
+macro(add_RunCMake_test test)
+ add_test(RunCMake.${test} ${CMAKE_CMAKE_COMMAND}
+ -DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR}
+ -DRunCMake_GENERATOR=${CMAKE_TEST_GENERATOR}
+ -DRunCMake_GENERATOR_TOOLSET=${CMAKE_TEST_GENERATOR_TOOLSET}
+ -DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${test}
+ -DRunCMake_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/${test}
+ ${${test}_ARGS}
+ -P "${CMAKE_CURRENT_SOURCE_DIR}/${test}/RunCMakeTest.cmake"
+ )
+endmacro()
+
+if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 3)
+ set(GeneratorToolset_ARGS -DXCODE_BELOW_3=1)
+endif()
+
+add_RunCMake_test(CMP0019)
+add_RunCMake_test(CMP0022)
+add_RunCMake_test(CMP0026)
+add_RunCMake_test(CMP0027)
+add_RunCMake_test(CMP0028)
+add_RunCMake_test(CMP0037)
+add_RunCMake_test(CMP0038)
+add_RunCMake_test(CMP0039)
+add_RunCMake_test(CMP0040)
+add_RunCMake_test(CMP0041)
+add_RunCMake_test(CTest)
+if(UNIX AND "${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles")
+ add_RunCMake_test(CompilerChange)
+endif()
+add_RunCMake_test(CompilerNotFound)
+add_RunCMake_test(Configure)
+add_RunCMake_test(DisallowedCommands)
+add_RunCMake_test(ExternalData)
+add_RunCMake_test(FPHSA)
+add_RunCMake_test(GeneratorExpression)
+add_RunCMake_test(GeneratorToolset)
+add_RunCMake_test(TargetPropertyGeneratorExpressions)
+add_RunCMake_test(Languages)
+add_RunCMake_test(ObjectLibrary)
+if(NOT WIN32)
+ add_RunCMake_test(PositionIndependentCode)
+ set(SKIP_VISIBILITY 0)
+ if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" AND "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS 4.2)
+ set(SKIP_VISIBILITY 1)
+ endif()
+
+ if (CMAKE_CXX_COMPILER_ID MATCHES Watcom
+ OR CMAKE_SYSTEM_NAME MATCHES IRIX64
+ OR CMAKE_CXX_COMPILER_ID MATCHES HP
+ OR CMAKE_CXX_COMPILER_ID MATCHES XL
+ OR CMAKE_CXX_COMPILER_ID MATCHES SunPro)
+ set(SKIP_VISIBILITY 1)
+ endif()
+
+ if (NOT SKIP_VISIBILITY)
+ add_RunCMake_test(VisibilityPreset)
+ endif()
+endif()
+if (QT4_FOUND)
+ set(CompatibleInterface_ARGS -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE})
+endif()
+add_RunCMake_test(CompatibleInterface)
+add_RunCMake_test(Syntax)
+
+add_RunCMake_test(add_dependencies)
+add_RunCMake_test(build_command)
+add_RunCMake_test(export)
+add_RunCMake_test(cmake_minimum_required)
+add_RunCMake_test(find_package)
+add_RunCMake_test(get_filename_component)
+add_RunCMake_test(if)
+add_RunCMake_test(include)
+add_RunCMake_test(include_directories)
+add_RunCMake_test(list)
+add_RunCMake_test(message)
+add_RunCMake_test(string)
+add_RunCMake_test(try_compile)
+add_RunCMake_test(set)
+add_RunCMake_test(variable_watch)
+add_RunCMake_test(CMP0004)
+add_RunCMake_test(TargetPolicies)
+add_RunCMake_test(alias_targets)
+add_RunCMake_test(interface_library)
+add_RunCMake_test(no_install_prefix)
+
+find_package(Qt4 QUIET)
+find_package(Qt5Core QUIET)
+if (QT4_FOUND AND Qt5Core_FOUND AND NOT Qt5Core_VERSION VERSION_LESS 5.1.0)
+ add_RunCMake_test(IncompatibleQt)
+endif()
+if (QT4_FOUND)
+ set(ObsoleteQtMacros_ARGS -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE})
+ add_RunCMake_test(ObsoleteQtMacros)
+endif()
+
+if("${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio [^6]")
+ add_RunCMake_test(include_external_msproject)
+ add_RunCMake_test(SolutionGlobalSections)
+endif()
+
+add_RunCMake_test(File_Generate)
+add_RunCMake_test(ExportWithoutLanguage)
+add_RunCMake_test(target_link_libraries)
+add_RunCMake_test(CheckModules)
diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
index 6533b75..5a80872 100644
--- a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
+++ b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
@@ -11,3 +11,8 @@
\* CMP0020
\* CMP0021
\* CMP0022
+ \* CMP0041
+ \* CMP0042
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/install/CMakeLists.txt b/Tests/RunCMake/install/CMakeLists.txt
new file mode 100644
index 0000000..4b3de84
--- /dev/null
+++ b/Tests/RunCMake/install/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8.12)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake
new file mode 100644
index 0000000..c8dc379
--- /dev/null
+++ b/Tests/RunCMake/install/RunCMakeTest.cmake
@@ -0,0 +1,4 @@
+include(RunCMake)
+run_cmake(SkipInstallRulesWarning)
+run_cmake(SkipInstallRulesNoWarning1)
+run_cmake(SkipInstallRulesNoWarning2)
diff --git a/Tests/RunCMake/install/SkipInstallRulesNoWarning1-check.cmake b/Tests/RunCMake/install/SkipInstallRulesNoWarning1-check.cmake
new file mode 100644
index 0000000..2807698
--- /dev/null
+++ b/Tests/RunCMake/install/SkipInstallRulesNoWarning1-check.cmake
@@ -0,0 +1,9 @@
+if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/CMakeCache.txt")
+ message(FATAL_ERROR "missing test prerequisite CMakeCache.txt")
+endif()
+
+set(CMAKE_INSTALL_CMAKE "${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake")
+
+if(EXISTS ${CMAKE_INSTALL_CMAKE})
+ message(FATAL_ERROR "${CMAKE_INSTALL_CMAKE} should not exist")
+endif()
diff --git a/Tests/RunCMake/install/SkipInstallRulesNoWarning1-stderr.txt b/Tests/RunCMake/install/SkipInstallRulesNoWarning1-stderr.txt
new file mode 100644
index 0000000..10f3293
--- /dev/null
+++ b/Tests/RunCMake/install/SkipInstallRulesNoWarning1-stderr.txt
@@ -0,0 +1 @@
+^$
diff --git a/Tests/RunCMake/install/SkipInstallRulesNoWarning1.cmake b/Tests/RunCMake/install/SkipInstallRulesNoWarning1.cmake
new file mode 100644
index 0000000..22c7f8c
--- /dev/null
+++ b/Tests/RunCMake/install/SkipInstallRulesNoWarning1.cmake
@@ -0,0 +1 @@
+set(CMAKE_SKIP_INSTALL_RULES ON)
diff --git a/Tests/RunCMake/install/SkipInstallRulesNoWarning2-check.cmake b/Tests/RunCMake/install/SkipInstallRulesNoWarning2-check.cmake
new file mode 100644
index 0000000..4372b77
--- /dev/null
+++ b/Tests/RunCMake/install/SkipInstallRulesNoWarning2-check.cmake
@@ -0,0 +1,9 @@
+if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/CMakeCache.txt")
+ message(FATAL_ERROR "missing test prerequisite CMakeCache.txt")
+endif()
+
+set(CMAKE_INSTALL_CMAKE "${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake")
+
+if(NOT EXISTS ${CMAKE_INSTALL_CMAKE})
+ message(FATAL_ERROR "${CMAKE_INSTALL_CMAKE} should exist")
+endif()
diff --git a/Tests/RunCMake/install/SkipInstallRulesNoWarning2-stderr.txt b/Tests/RunCMake/install/SkipInstallRulesNoWarning2-stderr.txt
new file mode 100644
index 0000000..10f3293
--- /dev/null
+++ b/Tests/RunCMake/install/SkipInstallRulesNoWarning2-stderr.txt
@@ -0,0 +1 @@
+^$
diff --git a/Tests/RunCMake/install/SkipInstallRulesNoWarning2.cmake b/Tests/RunCMake/install/SkipInstallRulesNoWarning2.cmake
new file mode 100644
index 0000000..2f5f03a
--- /dev/null
+++ b/Tests/RunCMake/install/SkipInstallRulesNoWarning2.cmake
@@ -0,0 +1 @@
+install(FILES CMakeLists.txt DESTINATION src)
diff --git a/Tests/RunCMake/install/SkipInstallRulesWarning-check.cmake b/Tests/RunCMake/install/SkipInstallRulesWarning-check.cmake
new file mode 100644
index 0000000..2807698
--- /dev/null
+++ b/Tests/RunCMake/install/SkipInstallRulesWarning-check.cmake
@@ -0,0 +1,9 @@
+if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/CMakeCache.txt")
+ message(FATAL_ERROR "missing test prerequisite CMakeCache.txt")
+endif()
+
+set(CMAKE_INSTALL_CMAKE "${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake")
+
+if(EXISTS ${CMAKE_INSTALL_CMAKE})
+ message(FATAL_ERROR "${CMAKE_INSTALL_CMAKE} should not exist")
+endif()
diff --git a/Tests/RunCMake/install/SkipInstallRulesWarning-stderr.txt b/Tests/RunCMake/install/SkipInstallRulesWarning-stderr.txt
new file mode 100644
index 0000000..9130526
--- /dev/null
+++ b/Tests/RunCMake/install/SkipInstallRulesWarning-stderr.txt
@@ -0,0 +1,3 @@
+CMake Warning in CMakeLists.txt:
+ CMAKE_SKIP_INSTALL_RULES was enabled even though installation rules have
+ been specified
diff --git a/Tests/RunCMake/install/SkipInstallRulesWarning.cmake b/Tests/RunCMake/install/SkipInstallRulesWarning.cmake
new file mode 100644
index 0000000..b621d9b
--- /dev/null
+++ b/Tests/RunCMake/install/SkipInstallRulesWarning.cmake
@@ -0,0 +1,2 @@
+set(CMAKE_SKIP_INSTALL_RULES ON)
+install(FILES CMakeLists.txt DESTINATION src)