summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/CPackRPM.cmake12
-rw-r--r--Modules/Compiler/GNU.cmake1
-rw-r--r--Modules/ExternalProject.cmake12
-rw-r--r--Modules/FindPNG.cmake5
-rw-r--r--Modules/FindQt4.cmake2
-rw-r--r--Modules/GetPrerequisites.cmake1
-rw-r--r--Modules/Qt4Macros.cmake22
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CursesDialog/form/fty_ipv4.c2
-rw-r--r--Source/cmComputeLinkInformation.cxx11
-rw-r--r--Source/cmComputeTargetDepends.cxx2
-rw-r--r--Source/cmCoreTryCompile.cxx62
-rw-r--r--Source/cmDocumentVariables.cxx34
-rw-r--r--Source/cmExportBuildFileGenerator.cxx9
-rw-r--r--Source/cmExportCommand.cxx2
-rw-r--r--Source/cmExportCommand.h7
-rw-r--r--Source/cmExportFileGenerator.cxx50
-rw-r--r--Source/cmExportFileGenerator.h11
-rw-r--r--Source/cmExportInstallFileGenerator.cxx23
-rw-r--r--Source/cmExtraCodeBlocksGenerator.cxx18
-rw-r--r--Source/cmExtraSublimeTextGenerator.cxx4
-rw-r--r--Source/cmFindCommon.cxx24
-rw-r--r--Source/cmGeneratorExpressionDAGChecker.cxx27
-rw-r--r--Source/cmGeneratorExpressionDAGChecker.h7
-rw-r--r--Source/cmGeneratorExpressionEvaluator.cxx71
-rw-r--r--Source/cmGeneratorTarget.cxx45
-rw-r--r--Source/cmGeneratorTarget.h4
-rw-r--r--Source/cmGlobalGenerator.cxx46
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx5
-rw-r--r--Source/cmIDEOptions.cxx5
-rw-r--r--Source/cmIDEOptions.h1
-rw-r--r--Source/cmIncludeCommand.h9
-rw-r--r--Source/cmInstallCommand.cxx33
-rw-r--r--Source/cmInstallCommand.h5
-rw-r--r--Source/cmInstallExportGenerator.cxx3
-rw-r--r--Source/cmInstallExportGenerator.h3
-rw-r--r--Source/cmLocalGenerator.cxx31
-rw-r--r--Source/cmLocalGenerator.h6
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx4
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx20
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx4
-rw-r--r--Source/cmMakefile.cxx63
-rw-r--r--Source/cmMakefile.h8
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx16
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx20
-rw-r--r--Source/cmMakefileTargetGenerator.cxx25
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx22
-rw-r--r--Source/cmNinjaTargetGenerator.cxx26
-rw-r--r--Source/cmPolicies.cxx31
-rw-r--r--Source/cmPolicies.h1
-rw-r--r--Source/cmProjectCommand.h8
-rw-r--r--Source/cmQtAutomoc.cxx10
-rw-r--r--Source/cmSystemTools.cxx10
-rw-r--r--Source/cmTarget.cxx547
-rw-r--r--Source/cmTarget.h62
-rw-r--r--Source/cmTargetCompileDefinitionsCommand.cxx2
-rw-r--r--Source/cmTargetCompileDefinitionsCommand.h2
-rw-r--r--Source/cmTargetCompileOptionsCommand.cxx2
-rw-r--r--Source/cmTargetCompileOptionsCommand.h2
-rw-r--r--Source/cmTargetIncludeDirectoriesCommand.cxx34
-rw-r--r--Source/cmTargetIncludeDirectoriesCommand.h16
-rw-r--r--Source/cmTargetLinkLibrariesCommand.cxx26
-rw-r--r--Source/cmTargetLinkLibrariesCommand.h23
-rw-r--r--Source/cmTargetPropCommandBase.cxx60
-rw-r--r--Source/cmTargetPropCommandBase.h13
-rw-r--r--Source/cmTryCompileCommand.h4
-rw-r--r--Source/cmVS10LinkFlagTable.h2
-rw-r--r--Source/cmVS11LinkFlagTable.h2
-rw-r--r--Source/cmVS12LinkFlagTable.h2
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx5
-rw-r--r--Source/cmake.cxx10
-rw-r--r--Source/kwsys/SystemTools.cxx12
-rw-r--r--Tests/CMakeCommands/target_link_libraries/CMakeLists.txt2
-rw-r--r--Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt18
-rw-r--r--Tests/CMakeCommands/target_link_libraries/cmp0022/cmp0022exe.cpp7
-rw-r--r--Tests/CMakeCommands/target_link_libraries/cmp0022/cmp0022ifacelib.cpp9
-rw-r--r--Tests/CMakeCommands/target_link_libraries/cmp0022/cmp0022ifacelib.h9
-rw-r--r--Tests/CMakeCommands/target_link_libraries/cmp0022/cmp0022lib.cpp7
-rw-r--r--Tests/CMakeCommands/target_link_libraries/cmp0022/cmp0022lib.h6
-rw-r--r--Tests/CMakeLists.txt10
-rw-r--r--Tests/ExportImport/Export/CMakeLists.txt32
-rw-r--r--Tests/ExportImport/Export/cmp0022.cpp7
-rw-r--r--Tests/ExportImport/Export/cmp0022.h4
-rw-r--r--Tests/ExportImport/Export/cmp0022_vs6_1.cpp1
-rw-r--r--Tests/ExportImport/Export/cmp0022_vs6_2.cpp1
-rw-r--r--Tests/ExportImport/Import/A/CMakeLists.txt43
-rw-r--r--Tests/ExportImport/Import/A/cmp0022NEW_test.cpp12
-rw-r--r--Tests/ExportImport/Import/A/cmp0022NEW_test_vs6_1.cpp1
-rw-r--r--Tests/ExportImport/Import/A/cmp0022NEW_test_vs6_2.cpp1
-rw-r--r--Tests/ExportImport/Import/A/cmp0022OLD_test.cpp12
-rw-r--r--Tests/ExportImport/Import/A/cmp0022OLD_test_vs6_1.cpp1
-rw-r--r--Tests/ExportImport/Import/A/cmp0022OLD_test_vs6_2.cpp1
-rw-r--r--Tests/ExportImport/Import/A/excludedFromAll/CMakeLists.txt7
-rw-r--r--Tests/ExportImport/Import/A/excludedFromAll/excludedFromAll.cpp7
-rw-r--r--Tests/ExportImport/Import/A/excludedFromAll/excludedFromAll.h4
-rw-r--r--Tests/ExportImport/Import/A/iface_test.cpp11
-rw-r--r--Tests/IncludeDirectories/CMakeLists.txt17
-rw-r--r--Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt19
-rw-r--r--Tests/IncludeDirectories/SystemIncludeDirectories/consumer.cpp7
-rw-r--r--Tests/IncludeDirectories/SystemIncludeDirectories/systemlib.cpp4
-rw-r--r--Tests/IncludeDirectories/SystemIncludeDirectories/systemlib/systemlib.h19
-rw-r--r--Tests/IncludeDirectories/SystemIncludeDirectories/upstream.cpp4
-rw-r--r--Tests/IncludeDirectories/SystemIncludeDirectories/upstream.h12
-rw-r--r--Tests/InterfaceLinkLibraries/CMakeLists.txt49
-rw-r--r--Tests/InterfaceLinkLibraries/bang.cpp15
-rw-r--r--Tests/InterfaceLinkLibraries/bang.h4
-rw-r--r--Tests/InterfaceLinkLibraries/bang_vs6_1.cpp1
-rw-r--r--Tests/InterfaceLinkLibraries/bang_vs6_2.cpp1
-rw-r--r--Tests/InterfaceLinkLibraries/bar.cpp26
-rw-r--r--Tests/InterfaceLinkLibraries/bar.h7
-rw-r--r--Tests/InterfaceLinkLibraries/bar_vs6_1.cpp1
-rw-r--r--Tests/InterfaceLinkLibraries/bar_vs6_2.cpp1
-rw-r--r--Tests/InterfaceLinkLibraries/bar_vs6_3.cpp1
-rw-r--r--Tests/InterfaceLinkLibraries/bar_vs6_4.cpp1
-rw-r--r--Tests/InterfaceLinkLibraries/foo.cpp15
-rw-r--r--Tests/InterfaceLinkLibraries/foo.h4
-rw-r--r--Tests/InterfaceLinkLibraries/foo_vs6_1.cpp1
-rw-r--r--Tests/InterfaceLinkLibraries/foo_vs6_2.cpp1
-rw-r--r--Tests/InterfaceLinkLibraries/foo_vs6_3.cpp1
-rw-r--r--Tests/InterfaceLinkLibraries/foo_vs6_4.cpp1
-rw-r--r--Tests/InterfaceLinkLibraries/main.cpp19
-rw-r--r--Tests/InterfaceLinkLibraries/main_vs6_1.cpp1
-rw-r--r--Tests/InterfaceLinkLibraries/main_vs6_2.cpp1
-rw-r--r--Tests/InterfaceLinkLibraries/main_vs6_3.cpp1
-rw-r--r--Tests/InterfaceLinkLibraries/main_vs6_4.cpp1
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-link_libraries-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-link_libraries.cmake9
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-NOWARN-static.cmake8
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-WARN-static-result.txt1
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-WARN-static-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-WARN-static.cmake11
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-WARN-stderr.txt8
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-WARN-tll-result.txt1
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-WARN-tll-stderr.txt8
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-WARN-tll.cmake11
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-WARN.cmake11
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-export-result.txt1
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-export-stderr.txt4
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-export.cmake11
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-install-export-result.txt1
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-install-export-stderr.txt4
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-install-export.cmake12
-rw-r--r--Tests/RunCMake/CMP0022/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/CMP0022/RunCMakeTest.cmake9
-rw-r--r--Tests/RunCMake/CMP0022/dep1/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/CMP0022/dep2/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/CMP0022/dep3/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/CMP0022/empty.cpp7
-rw-r--r--Tests/RunCMake/CMP0022/empty_vs6_1.cpp1
-rw-r--r--Tests/RunCMake/CMP0022/empty_vs6_2.cpp1
-rw-r--r--Tests/RunCMake/CMP0022/empty_vs6_3.cpp1
-rw-r--r--Tests/RunCMake/CMakeLists.txt7
-rw-r--r--Tests/RunCMake/Configure/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/Configure/ErrorLogs-result.txt1
-rw-r--r--Tests/RunCMake/Configure/ErrorLogs-stderr.txt4
-rw-r--r--Tests/RunCMake/Configure/ErrorLogs-stdout.txt3
-rw-r--r--Tests/RunCMake/Configure/ErrorLogs.cmake3
-rw-r--r--Tests/RunCMake/Configure/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/ObsoleteQtMacros/AutomocMacro-WARN-result.txt1
-rw-r--r--Tests/RunCMake/ObsoleteQtMacros/AutomocMacro-WARN-stderr.txt5
-rw-r--r--Tests/RunCMake/ObsoleteQtMacros/AutomocMacro-WARN.cmake7
-rw-r--r--Tests/RunCMake/ObsoleteQtMacros/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/ObsoleteQtMacros/RunCMakeTest.cmake6
-rw-r--r--Tests/RunCMake/ObsoleteQtMacros/UseModulesMacro-WARN-result.txt1
-rw-r--r--Tests/RunCMake/ObsoleteQtMacros/UseModulesMacro-WARN-stderr.txt6
-rw-r--r--Tests/RunCMake/ObsoleteQtMacros/UseModulesMacro-WARN.cmake7
-rw-r--r--Tests/RunCMake/ObsoleteQtMacros/empty.cpp7
-rw-r--r--Tests/RunCMake/TargetPolicies/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/TargetPolicies/PolicyList-result.txt1
-rw-r--r--Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt13
-rw-r--r--Tests/RunCMake/TargetPolicies/PolicyList.cmake8
-rw-r--r--Tests/RunCMake/TargetPolicies/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/TargetPolicies/empty.cpp7
-rw-r--r--Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile-stderr.txt4
-rw-r--r--Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile.cmake2
-rw-r--r--Tests/RunCMake/try_compile/NoCopyFileError-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/NoCopyFileError-stderr.txt4
-rw-r--r--Tests/RunCMake/try_compile/NoCopyFileError.cmake2
-rw-r--r--Tests/RunCMake/try_compile/RunCMakeTest.cmake2
-rw-r--r--Tests/TryCompile/CMakeLists.txt35
-rw-r--r--Tests/TryCompile/testdef.c4
-rw-r--r--Utilities/cmcurl/Testing/sepheaders.c2
-rw-r--r--Utilities/cmcurl/Testing/simplessl.c2
-rw-r--r--Utilities/cmcurl/cookie.c2
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_string.c2
187 files changed, 2037 insertions, 431 deletions
diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake
index 52fdc91..bf5b5bc 100644
--- a/Modules/CPackRPM.cmake
+++ b/Modules/CPackRPM.cmake
@@ -637,7 +637,7 @@ if(CPACK_RPM_CHANGELOG_FILE)
message(SEND_ERROR "CPackRPM:Warning: CPACK_RPM_CHANGELOG_FILE <${CPACK_RPM_CHANGELOG_FILE}> does not exists - ignoring")
endif()
else()
- set(CPACK_RPM_SPEC_CHANGELOG "* Sun Jul 4 2010 Erk <eric.noulard@gmail.com>\n Generated by CPack RPM (no Changelog file were provided)")
+ set(CPACK_RPM_SPEC_CHANGELOG "* Sun Jul 4 2010 Eric Noulard <eric.noulard@gmail.com> - ${CPACK_RPM_PACKAGE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}\n Generated by CPack RPM (no Changelog file were provided)")
endif()
# CPACK_RPM_SPEC_MORE_DEFINE
@@ -876,6 +876,13 @@ if(CPACK_RPM_PACKAGE_DEBUG)
message("CPackRPM:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}")
endif()
+# protect @ in pathname in order to avoid their
+# interpretation during the configure_file step
+set(CPACK_RPM_INSTALL_FILES_LIST "${CPACK_RPM_INSTALL_FILES}")
+set(PROTECTED_AT "@")
+string(REPLACE "@" "\@PROTECTED_AT\@" CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES_LIST}")
+set(CPACK_RPM_INSTALL_FILES_LIST "")
+
#
# USER generated/provided spec file handling.
#
@@ -982,6 +989,9 @@ else()
configure_file(${CPACK_RPM_BINARY_SPECFILE}.in ${CPACK_RPM_BINARY_SPECFILE} @ONLY)
endif()
+# remove AT protection
+unset(PROTECTED_AT)
+
if(RPMBUILD_EXECUTABLE)
# Now call rpmbuild using the SPECFILE
execute_process(
diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake
index e5e10c3..504704d 100644
--- a/Modules/Compiler/GNU.cmake
+++ b/Modules/Compiler/GNU.cmake
@@ -30,7 +30,6 @@ macro(__compiler_gnu lang)
endif()
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
- set(CMAKE_SYSROOT_FLAG "--sysroot=")
# Older versions of gcc (< 4.5) contain a bug causing them to report a missing
# header file as a warning if depfiles are enabled, causing check_header_file
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 6afdb97..0781ea1 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -114,6 +114,15 @@
# and <TMP_DIR>
# with corresponding property values.
#
+# Any builtin step that specifies a "<step>_COMMAND cmd..." or custom
+# step that specifies a "COMMAND cmd..." may specify additional command
+# lines using the form "COMMAND cmd...". At build time the commands will
+# be executed in order and aborted if any one fails. For example:
+# ... BUILD_COMMAND make COMMAND echo done ...
+# specifies to run "make" and then "echo done" during the build step.
+# Whether the current working directory is preserved between commands
+# is not defined. Behavior of shell operators like "&&" is not defined.
+#
# The 'ExternalProject_Get_Property' function retrieves external project
# target properties:
# ExternalProject_Get_Property(<name> [prop1 [prop2 [...]]])
@@ -961,7 +970,7 @@ endif()
set(sep ";")
endif()
endforeach()
- set(code "set(ENV{VS_UNICODE_OUTPUT} \"\")\n${code}set(command \"${cmd}\")${code_execute_process}")
+ set(code "${code}set(command \"${cmd}\")${code_execute_process}")
file(WRITE ${stamp_dir}/${name}-${step}-impl.cmake "${code}")
set(command ${CMAKE_COMMAND} "-Dmake=\${make}" "-Dconfig=\${config}" -P ${stamp_dir}/${name}-${step}-impl.cmake)
endif()
@@ -971,7 +980,6 @@ endif()
set(logbase ${stamp_dir}/${name}-${step})
file(WRITE ${script} "
${code_cygpath_make}
-set(ENV{VS_UNICODE_OUTPUT} \"\")
set(command \"${command}\")
execute_process(
COMMAND \${command}
diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake
index d96d2cc..fef4669 100644
--- a/Modules/FindPNG.cmake
+++ b/Modules/FindPNG.cmake
@@ -38,7 +38,10 @@ if(ZLIB_FOUND)
/usr/local/include/libpng # OpenBSD
)
- set(PNG_NAMES ${PNG_NAMES} png libpng png15 libpng15 png15d libpng15d png14 libpng14 png14d libpng14d png12 libpng12 png12d libpng12d)
+ list(APPEND PNG_NAMES png libpng)
+ foreach(v 16 15 14 12)
+ list(APPEND PNG_NAMES png${v} libpng${v} png${v}d libpng${v}d)
+ endforeach()
find_library(PNG_LIBRARY NAMES ${PNG_NAMES} )
if (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR)
diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake
index 8ce1934..7b37e1e 100644
--- a/Modules/FindQt4.cmake
+++ b/Modules/FindQt4.cmake
@@ -100,6 +100,7 @@
# because you need a custom filename for the moc file or something similar.
#
# macro QT4_AUTOMOC(sourcefile1 sourcefile2 ... )
+# The qt4_automoc macro is obsolete. Use the CMAKE_AUTOMOC feature instead.
# This macro is still experimental.
# It can be used to have moc automatically handled.
# So if you have the files foo.h and foo.cpp, and in foo.h a
@@ -174,6 +175,7 @@
# must exist and are not updated in any way.
#
# function QT4_USE_MODULES( target [link_type] modules...)
+# This function is obsolete. Use target_link_libraries with IMPORTED targets instead.
# Make <target> use the <modules> from Qt. Using a Qt module means
# to link to the library, add the relevant include directories for the module,
# and add the relevant compiler defines for using the module.
diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake
index 18f449d..9e89788 100644
--- a/Modules/GetPrerequisites.cmake
+++ b/Modules/GetPrerequisites.cmake
@@ -635,7 +635,6 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
set(gp_regex_fallback "")
set(gp_regex_cmp_count 1)
set(gp_tool_known 1)
- set(ENV{VS_UNICODE_OUTPUT} "") # Block extra output from inside VS IDE.
endif()
if("${gp_tool}" STREQUAL "objdump")
diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake
index a0b2e31..5e13b59 100644
--- a/Modules/Qt4Macros.cmake
+++ b/Modules/Qt4Macros.cmake
@@ -357,6 +357,17 @@ endmacro()
macro(QT4_AUTOMOC)
+ if(NOT CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.11)
+ if(CMAKE_WARN_DEPRECATED)
+ set(messageType WARNING)
+ endif()
+ if(CMAKE_ERROR_DEPRECATED)
+ set(messageType FATAL_ERROR)
+ endif()
+ if(messageType)
+ message(${messageType} "The qt4_automoc macro is obsolete. Use the CMAKE_AUTOMOC feature instead.")
+ endif()
+ endif()
QT4_GET_MOC_FLAGS(_moc_INCS)
set(_matching_FILES )
@@ -467,6 +478,17 @@ macro(QT4_ADD_TRANSLATION _qm_files)
endmacro()
function(qt4_use_modules _target _link_type)
+ if(NOT CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.11)
+ if(CMAKE_WARN_DEPRECATED)
+ set(messageType WARNING)
+ endif()
+ if(CMAKE_ERROR_DEPRECATED)
+ set(messageType FATAL_ERROR)
+ endif()
+ if(messageType)
+ message(${messageType} "The qt4_use_modules function is obsolete. Use target_link_libraries with IMPORTED targets instead.")
+ endif()
+ endif()
if ("${_link_type}" STREQUAL "LINK_PUBLIC" OR "${_link_type}" STREQUAL "LINK_PRIVATE")
set(modules ${ARGN})
set(link_type ${_link_type})
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 80d424e..0ef54dd 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 11)
-set(CMake_VERSION_TWEAK 20130715)
+set(CMake_VERSION_TWEAK 20130716)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CursesDialog/form/fty_ipv4.c b/Source/CursesDialog/form/fty_ipv4.c
index 4ac8a50..c855af6 100644
--- a/Source/CursesDialog/form/fty_ipv4.c
+++ b/Source/CursesDialog/form/fty_ipv4.c
@@ -30,7 +30,7 @@ static bool Check_IPV4_Field(FIELD * field, const void * argp)
{
char *bp = field_buffer(field,0);
int num = 0, len;
- unsigned int d1, d2, d3, d4;
+ unsigned int d1=256, d2=256, d3=256, d4=256;
argp=0; /* Silence unused parameter warning. */
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 0ba0139..ab9eb14 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -1884,8 +1884,6 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
}
if(use_build_rpath || use_link_rpath)
{
- std::string rootPath = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT");
- cmSystemTools::ConvertToUnixSlashes(rootPath);
std::vector<std::string> const& rdirs = this->GetRuntimeSearchPath();
for(std::vector<std::string>::const_iterator ri = rdirs.begin();
ri != rdirs.end(); ++ri)
@@ -1909,14 +1907,9 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
!cmSystemTools::IsSubDirectory(ri->c_str(), topSourceDir) &&
!cmSystemTools::IsSubDirectory(ri->c_str(), topBinaryDir))
{
- std::string d = *ri;
- if (d.find(rootPath) == 0)
+ if(emitted.insert(*ri).second)
{
- d = d.substr(rootPath.size());
- }
- if(emitted.insert(d).second)
- {
- runtimeDirs.push_back(d);
+ runtimeDirs.push_back(*ri);
}
}
}
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index 8fd95b9..0829add 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -282,6 +282,8 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index,
if(emitted.insert(*lib).second)
{
this->AddTargetDepend(depender_index, lib->c_str(), true);
+ this->AddInterfaceDepends(depender_index, lib->c_str(),
+ true, emitted);
}
}
}
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 860417f..086f27a 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -12,6 +12,7 @@
#include "cmCoreTryCompile.h"
#include "cmake.h"
#include "cmCacheManager.h"
+#include "cmLocalGenerator.h"
#include "cmGlobalGenerator.h"
#include "cmExportTryCompileFileGenerator.h"
#include <cmsys/Directory.hxx>
@@ -32,18 +33,20 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
std::vector<std::string> compileDefs;
std::string outputVariable;
std::string copyFile;
+ std::string copyFileError;
std::vector<cmTarget*> targets;
std::string libsToLink = " ";
bool useOldLinkLibs = true;
char targetNameBuf[64];
bool didOutputVariable = false;
bool didCopyFile = false;
+ bool didCopyFileError = false;
bool useSources = argv[2] == "SOURCES";
std::vector<std::string> sources;
enum Doing { DoingNone, DoingCMakeFlags, DoingCompileDefinitions,
DoingLinkLibraries, DoingOutputVariable, DoingCopyFile,
- DoingSources };
+ DoingCopyFileError, DoingSources };
Doing doing = useSources? DoingSources : DoingNone;
for(size_t i=3; i < argv.size(); ++i)
{
@@ -74,6 +77,11 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
doing = DoingCopyFile;
didCopyFile = true;
}
+ else if(argv[i] == "COPY_FILE_ERROR")
+ {
+ doing = DoingCopyFileError;
+ didCopyFileError = true;
+ }
else if(doing == DoingCMakeFlags)
{
cmakeFlags.push_back(argv[i]);
@@ -121,6 +129,11 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
copyFile = argv[i].c_str();
doing = DoingNone;
}
+ else if(doing == DoingCopyFileError)
+ {
+ copyFileError = argv[i].c_str();
+ doing = DoingNone;
+ }
else if(doing == DoingSources)
{
sources.push_back(argv[i]);
@@ -149,6 +162,20 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
return -1;
}
+ if(didCopyFileError && copyFileError.empty())
+ {
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR,
+ "COPY_FILE_ERROR must be followed by a variable name");
+ return -1;
+ }
+
+ if(didCopyFileError && !didCopyFile)
+ {
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR,
+ "COPY_FILE_ERROR may be used only with COPY_FILE");
+ return -1;
+ }
+
if(didOutputVariable && outputVariable.empty())
{
this->Makefile->IssueMessage(cmake::FATAL_ERROR,
@@ -214,8 +241,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
}
// Detect languages to enable.
- cmGlobalGenerator* gg =
- this->Makefile->GetCMakeInstance()->GetGlobalGenerator();
+ cmLocalGenerator* lg = this->Makefile->GetLocalGenerator();
+ cmGlobalGenerator* gg = lg->GetGlobalGenerator();
std::set<std::string> testLangs;
for(std::vector<std::string>::iterator si = sources.begin();
si != sources.end(); ++si)
@@ -295,13 +322,12 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
for(std::set<std::string>::iterator li = testLangs.begin();
li != testLangs.end(); ++li)
{
- fprintf(fout, "SET(CMAKE_%s_FLAGS \"", li->c_str());
std::string langFlags = "CMAKE_" + *li + "_FLAGS";
- if(const char* flags = this->Makefile->GetDefinition(langFlags.c_str()))
- {
- fprintf(fout, " %s ", flags);
- }
- fprintf(fout, " ${COMPILE_DEFINITIONS}\")\n");
+ const char* flags = this->Makefile->GetDefinition(langFlags.c_str());
+ fprintf(fout, "SET(CMAKE_%s_FLAGS %s)\n", li->c_str(),
+ lg->EscapeForCMake(flags?flags:"").c_str());
+ fprintf(fout, "SET(CMAKE_%s_FLAGS \"${CMAKE_%s_FLAGS}"
+ " ${COMPILE_DEFINITIONS}\")\n", li->c_str(), li->c_str());
}
fprintf(fout, "INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES})\n");
fprintf(fout, "SET(CMAKE_SUPPRESS_REGENERATION 1)\n");
@@ -444,6 +470,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
if (this->SrcFileSignature)
{
+ std::string copyFileErrorMessage;
this->FindOutputFile(targetName);
if ((res==0) && (copyFile.size()))
@@ -461,10 +488,23 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
{
emsg << this->FindErrorMessage.c_str();
}
- this->Makefile->IssueMessage(cmake::FATAL_ERROR, emsg.str());
- return -1;
+ if(copyFileError.empty())
+ {
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR, emsg.str());
+ return -1;
+ }
+ else
+ {
+ copyFileErrorMessage = emsg.str();
+ }
}
}
+
+ if(!copyFileError.empty())
+ {
+ this->Makefile->AddDefinition(copyFileError.c_str(),
+ copyFileErrorMessage.c_str());
+ }
}
return res;
}
diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx
index 0a78ccf..fcaa169 100644
--- a/Source/cmDocumentVariables.cxx
+++ b/Source/cmDocumentVariables.cxx
@@ -514,6 +514,13 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"analysis of libraries linked by a target.",
false,
"Variables that Provide Information");
+ cm->DefineProperty
+ ("CMAKE_MINIMUM_REQUIRED_VERSION", cmProperty::VARIABLE,
+ "Version specified to cmake_minimum_required command",
+ "Variable containing the VERSION component specified in the "
+ "cmake_minimum_required command.",
+ false,
+ "Variables that Provide Information");
// Variables defined by cmake, that change the behavior
@@ -561,16 +568,6 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"Variables That Change Behavior");
cm->DefineProperty
- ("CMAKE_SYSROOT", cmProperty::VARIABLE,
- "Path to pass to the compiler in the --sysroot flag.",
- "The CMAKE_SYSROOT content is passed to the compiler in the --sysroot "
- "flag, if supported. The path is also stripped from the RPATH if "
- "necessary on installation. The CMAKE_SYSROOT is also used to prefix "
- "paths searched by the find_* commands.",
- false,
- "Variables That Change Behavior");
-
- cm->DefineProperty
("CMAKE_FIND_LIBRARY_PREFIXES", cmProperty::VARIABLE,
"Prefixes to prepend when looking for libraries.",
"This specifies what prefixes to add to library names when "
@@ -688,6 +685,23 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"Variables That Change Behavior");
cm->DefineProperty
+ ("CMAKE_WARN_DEPRECATED", cmProperty::VARIABLE,
+ "Whether to issue deprecation warnings for macros and functions.",
+ "If TRUE, this can be used by macros and functions to issue "
+ "deprecation warnings. This variable is FALSE by default.",
+ false,
+ "Variables That Change Behavior");
+
+ cm->DefineProperty
+ ("CMAKE_ERROR_DEPRECATED", cmProperty::VARIABLE,
+ "Whether to issue deprecation errors for macros and functions.",
+ "If TRUE, this can be used by macros and functions to issue "
+ "fatal errors when deprecated macros or functions are used. This "
+ "variable is FALSE by default.",
+ false,
+ "Variables That Change Behavior");
+
+ cm->DefineProperty
("CMAKE_PREFIX_PATH", cmProperty::VARIABLE,
"Path used for searching by FIND_XXX(), with appropriate suffixes added.",
"Specifies a path which will be used by the FIND_XXX() commands. It "
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index 326663c..cdc3316 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -77,6 +77,15 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
properties, missingTargets);
this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE",
te, properties);
+ const bool newCMP0022Behavior =
+ te->GetPolicyStatusCMP0022() != cmPolicies::WARN
+ && te->GetPolicyStatusCMP0022() != cmPolicies::OLD;
+ if (newCMP0022Behavior)
+ {
+ this->PopulateInterfaceLinkLibrariesProperty(te,
+ cmGeneratorExpression::BuildInterface,
+ properties, missingTargets);
+ }
this->PopulateCompatibleInterfaceProperties(te, properties);
this->GenerateInterfaceProperties(te, os, properties);
diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx
index ffa8b51..9c3f314 100644
--- a/Source/cmExportCommand.cxx
+++ b/Source/cmExportCommand.cxx
@@ -30,6 +30,7 @@ cmExportCommand::cmExportCommand()
,Append(&Helper, "APPEND", &ArgumentGroup)
,Namespace(&Helper, "NAMESPACE", &ArgumentGroup)
,Filename(&Helper, "FILE", &ArgumentGroup)
+,ExportOld(&Helper, "EXPORT_LINK_INTERFACE_LIBRARIES", &ArgumentGroup)
{
// at first TARGETS
this->Targets.Follows(0);
@@ -158,6 +159,7 @@ bool cmExportCommand
ebfg.SetAppendMode(this->Append.IsEnabled());
ebfg.SetExports(&targets);
ebfg.SetCommand(this);
+ ebfg.SetExportOld(this->ExportOld.IsEnabled());
// Compute the set of configurations exported.
std::vector<std::string> configurationTypes;
diff --git a/Source/cmExportCommand.h b/Source/cmExportCommand.h
index ae67b47..87c3452 100644
--- a/Source/cmExportCommand.h
+++ b/Source/cmExportCommand.h
@@ -63,7 +63,7 @@ public:
{
return
" export(TARGETS [target1 [target2 [...]]] [NAMESPACE <namespace>]\n"
- " [APPEND] FILE <filename>)\n"
+ " [APPEND] FILE <filename> [EXPORT_LINK_INTERFACE_LIBRARIES])\n"
"Create a file <filename> that may be included by outside projects to "
"import targets from the current project's build tree. "
"This is useful during cross-compiling to build utility executables "
@@ -73,6 +73,10 @@ public:
"prepended to all target names written to the file. "
"If the APPEND option is given the generated code will be appended "
"to the file instead of overwriting it. "
+ "The EXPORT_LINK_INTERFACE_LIBRARIES keyword, if present, causes the "
+ "contents of the properties matching "
+ "(IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)? to be exported, when "
+ "policy CMP0022 is NEW. "
"If a library target is included in the export but "
"a target to which it links is not included the behavior is "
"unspecified."
@@ -104,6 +108,7 @@ private:
cmCAEnabler Append;
cmCAString Namespace;
cmCAString Filename;
+ cmCAEnabler ExportOld;
friend class cmExportBuildFileGenerator;
std::string ErrorMessage;
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 6bef017..b4e6e81 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -30,6 +30,7 @@
cmExportFileGenerator::cmExportFileGenerator()
{
this->AppendMode = false;
+ this->ExportOld = false;
}
//----------------------------------------------------------------------------
@@ -168,6 +169,39 @@ void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName,
}
}
+void cmExportFileGenerator::GenerateRequiredCMakeVersion(std::ostream& os,
+ const char *versionString)
+{
+ os << "if(CMAKE_VERSION VERSION_LESS " << versionString << ")\n"
+ " message(FATAL_ERROR \"This file relies on consumers using "
+ "CMake " << versionString << " or greater.\")\n"
+ "endif()\n\n";
+}
+
+//----------------------------------------------------------------------------
+bool cmExportFileGenerator::PopulateInterfaceLinkLibrariesProperty(
+ cmTarget *target,
+ cmGeneratorExpression::PreprocessContext preprocessRule,
+ ImportPropertyMap &properties,
+ std::vector<std::string> &missingTargets)
+{
+ const char *input = target->GetProperty("INTERFACE_LINK_LIBRARIES");
+ if (input)
+ {
+ std::string prepro = cmGeneratorExpression::Preprocess(input,
+ preprocessRule);
+ if (!prepro.empty())
+ {
+ this->ResolveTargetsInGeneratorExpressions(prepro, target,
+ missingTargets,
+ ReplaceFreeTargets);
+ properties["INTERFACE_LINK_LIBRARIES"] = prepro;
+ return true;
+ }
+ }
+ return false;
+}
+
//----------------------------------------------------------------------------
static bool isSubDirectory(const char* a, const char* b)
{
@@ -583,6 +617,22 @@ cmExportFileGenerator
return;
}
+ const bool newCMP0022Behavior =
+ target->GetPolicyStatusCMP0022() != cmPolicies::WARN
+ && target->GetPolicyStatusCMP0022() != cmPolicies::OLD;
+
+ if(newCMP0022Behavior && !this->ExportOld)
+ {
+ cmMakefile *mf = target->GetMakefile();
+ cmOStringStream e;
+ e << "Target \"" << target->GetName() << "\" has policy CMP0022 enabled, "
+ "but also has old-style INTERFACE_LINK_LIBRARIES properties "
+ "populated, but it was exported without the "
+ "EXPORT_LINK_INTERFACE_LIBRARIES to export the old-style properties";
+ mf->IssueMessage(cmake::FATAL_ERROR, e.str());
+ return;
+ }
+
if (!*propContent)
{
properties["IMPORTED_LINK_INTERFACE_LIBRARIES" + suffix] = "";
diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h
index ed2d93b..a624ba6 100644
--- a/Source/cmExportFileGenerator.h
+++ b/Source/cmExportFileGenerator.h
@@ -35,6 +35,8 @@ public:
/** Set the namespace in which to place exported target names. */
void SetNamespace(const char* ns) { this->Namespace = ns; }
+ void SetExportOld(bool exportOld) { this->ExportOld = exportOld; }
+
/** Add a configuration to be exported. */
void AddConfiguration(const char* config);
@@ -101,6 +103,10 @@ protected:
cmGeneratorExpression::PreprocessContext,
ImportPropertyMap &properties,
std::vector<std::string> &missingTargets);
+ bool PopulateInterfaceLinkLibrariesProperty(cmTarget *target,
+ cmGeneratorExpression::PreprocessContext,
+ ImportPropertyMap &properties,
+ std::vector<std::string> &missingTargets);
void PopulateInterfaceProperty(const char *propName, cmTarget *target,
ImportPropertyMap &properties);
void PopulateCompatibleInterfaceProperties(cmTarget *target,
@@ -128,9 +134,14 @@ protected:
std::vector<std::string> &missingTargets,
FreeTargetsReplace replace = NoReplaceFreeTargets);
+ void GenerateRequiredCMakeVersion(std::ostream& os,
+ const char *versionString);
+
// The namespace in which the exports are placed in the generated file.
std::string Namespace;
+ bool ExportOld;
+
// The set of configurations to export.
std::vector<std::string> Configurations;
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index a966b16..ce7afc5 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -113,6 +113,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
std::vector<std::string> missingTargets;
+ bool require2_8_12 = false;
// Create all the imported targets.
for(std::vector<cmTarget*>::const_iterator
tei = allTargets.begin();
@@ -126,6 +127,10 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
this->PopulateIncludeDirectoriesInterface(te,
cmGeneratorExpression::InstallInterface,
properties, missingTargets);
+ this->PopulateInterfaceProperty("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES",
+ te,
+ cmGeneratorExpression::InstallInterface,
+ properties, missingTargets);
this->PopulateInterfaceProperty("INTERFACE_COMPILE_DEFINITIONS",
te,
cmGeneratorExpression::InstallInterface,
@@ -134,6 +139,20 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
te,
cmGeneratorExpression::InstallInterface,
properties, missingTargets);
+
+ const bool newCMP0022Behavior =
+ te->GetPolicyStatusCMP0022() != cmPolicies::WARN
+ && te->GetPolicyStatusCMP0022() != cmPolicies::OLD;
+ if (newCMP0022Behavior)
+ {
+ if (this->PopulateInterfaceLinkLibrariesProperty(te,
+ cmGeneratorExpression::InstallInterface,
+ properties, missingTargets)
+ && !this->ExportOld)
+ {
+ require2_8_12 = true;
+ }
+ }
this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE",
te, properties);
this->PopulateCompatibleInterfaceProperties(te, properties);
@@ -141,6 +160,10 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
this->GenerateInterfaceProperties(te, os, properties);
}
+ if (require2_8_12)
+ {
+ this->GenerateRequiredCMakeVersion(os, "2.8.11.20130626");
+ }
// Now load per-configuration properties for them.
os << "# Load information for each installed configuration.\n"
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index f6f4cef..dfbb1c0 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -621,19 +621,15 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
->GetGeneratorTarget(target);
// the compilerdefines for this target
- std::string cdefs = target->GetCompileDefinitions(buildType);
+ std::vector<std::string> cdefs;
+ target->GetCompileDefinitions(cdefs, buildType);
- if(!cdefs.empty())
+ // Expand the list.
+ for(std::vector<std::string>::const_iterator di = cdefs.begin();
+ di != cdefs.end(); ++di)
{
- // Expand the list.
- std::vector<std::string> defs;
- cmSystemTools::ExpandListArgument(cdefs.c_str(), defs);
- for(std::vector<std::string>::const_iterator di = defs.begin();
- di != defs.end(); ++di)
- {
- cmXMLSafe safedef(di->c_str());
- fout <<" <Add option=\"-D" << safedef.str() << "\" />\n";
- }
+ cmXMLSafe safedef(di->c_str());
+ fout <<" <Add option=\"-D" << safedef.str() << "\" />\n";
}
// the include directories for this target
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index 012013c..523fca9 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -421,7 +421,7 @@ cmExtraSublimeTextGenerator::ComputeFlagsForObject(cmSourceFile* source,
std::vector<std::string> includes;
lg->GetIncludeDirectories(includes, gtgt, language, config);
std::string includeFlags =
- lg->GetIncludeFlags(includes, language, true); // full include paths
+ lg->GetIncludeFlags(includes, gtgt, language, true); // full include paths
lg->AppendFlags(flags, includeFlags.c_str());
}
@@ -463,7 +463,7 @@ ComputeDefines(cmSourceFile *source, cmLocalGenerator* lg, cmTarget *target,
}
// Add preprocessor definitions for this target and configuration.
- lg->AppendDefines(defines, target->GetCompileDefinitions(config));
+ lg->AddCompileDefinitions(defines, target, config);
lg->AppendDefines(defines, source->GetProperty("COMPILE_DEFINITIONS"));
{
std::string defPropName = "COMPILE_DEFINITIONS_";
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx
index 5daa47d..b44864e 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -62,15 +62,10 @@ void cmFindCommon::GenerateDocumentation()
"The CMake variable CMAKE_FIND_ROOT_PATH specifies one or more "
"directories to be prepended to all other search directories. "
"This effectively \"re-roots\" the entire search under given locations. "
- "By default it is empty. "
- "The variable CMAKE_SYSROOT can also be used to specify exactly one "
- "directory to use as a prefix. Setting CMAKE_SYSROOT also has other "
- "effects. See the documentation for that variable for more. "
- "These are especially useful when "
+ "By default it is empty. It is especially useful when "
"cross-compiling to point to the root directory of the "
"target environment and CMake will search there too. By default at first "
- "the CMAKE_SYSROOT directory is searched, then the directories listed in "
- "CMAKE_FIND_ROOT_PATH and then the non-rooted "
+ "the directories listed in CMAKE_FIND_ROOT_PATH and then the non-rooted "
"directories will be searched. "
"The default behavior can be adjusted by setting "
"CMAKE_FIND_ROOT_PATH_MODE_XXX. This behavior can be manually "
@@ -192,27 +187,16 @@ void cmFindCommon::RerootPaths(std::vector<std::string>& paths)
{
return;
}
- const char* sysroot =
- this->Makefile->GetDefinition("CMAKE_SYSROOT");
const char* rootPath =
this->Makefile->GetDefinition("CMAKE_FIND_ROOT_PATH");
- const bool noSysroot = !sysroot || !*sysroot;
- const bool noRootPath = !rootPath || !*rootPath;
- if(noSysroot && noRootPath)
+ if((rootPath == 0) || (strlen(rootPath) == 0))
{
return;
}
// Construct the list of path roots with no trailing slashes.
std::vector<std::string> roots;
- if (sysroot)
- {
- roots.push_back(sysroot);
- }
- if (rootPath)
- {
- cmSystemTools::ExpandListArgument(rootPath, roots);
- }
+ cmSystemTools::ExpandListArgument(rootPath, roots);
for(std::vector<std::string>::iterator ri = roots.begin();
ri != roots.end(); ++ri)
{
diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx
index 5b79e35..92dc054 100644
--- a/Source/cmGeneratorExpressionDAGChecker.cxx
+++ b/Source/cmGeneratorExpressionDAGChecker.cxx
@@ -22,7 +22,7 @@ cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker(
const GeneratorExpressionContent *content,
cmGeneratorExpressionDAGChecker *parent)
: Parent(parent), Target(target), Property(property),
- Content(content), Backtrace(backtrace)
+ Content(content), Backtrace(backtrace), TransitivePropertiesOnly(false)
{
const cmGeneratorExpressionDAGChecker *top = this;
const cmGeneratorExpressionDAGChecker *p = this->Parent;
@@ -139,6 +139,20 @@ cmGeneratorExpressionDAGChecker::checkGraph() const
}
//----------------------------------------------------------------------------
+bool cmGeneratorExpressionDAGChecker::GetTransitivePropertiesOnly()
+{
+ const cmGeneratorExpressionDAGChecker *top = this;
+ const cmGeneratorExpressionDAGChecker *parent = this->Parent;
+ while (parent)
+ {
+ top = parent;
+ parent = parent->Parent;
+ }
+
+ return top->TransitivePropertiesOnly;
+}
+
+//----------------------------------------------------------------------------
bool cmGeneratorExpressionDAGChecker::EvaluatingLinkLibraries(const char *tgt)
{
const cmGeneratorExpressionDAGChecker *top = this;
@@ -160,7 +174,8 @@ bool cmGeneratorExpressionDAGChecker::EvaluatingLinkLibraries(const char *tgt)
|| strcmp(prop, "LINK_INTERFACE_LIBRARIES") == 0
|| strcmp(prop, "IMPORTED_LINK_INTERFACE_LIBRARIES") == 0
|| strncmp(prop, "LINK_INTERFACE_LIBRARIES_", 25) == 0
- || strncmp(prop, "IMPORTED_LINK_INTERFACE_LIBRARIES_", 34) == 0);
+ || strncmp(prop, "IMPORTED_LINK_INTERFACE_LIBRARIES_", 34) == 0)
+ || strcmp(prop, "INTERFACE_LINK_LIBRARIES") == 0;
}
//----------------------------------------------------------------------------
@@ -172,6 +187,14 @@ bool cmGeneratorExpressionDAGChecker::EvaluatingIncludeDirectories() const
}
//----------------------------------------------------------------------------
+bool
+cmGeneratorExpressionDAGChecker::EvaluatingSystemIncludeDirectories() const
+{
+ const char *prop = this->Property.c_str();
+ return strcmp(prop, "INTERFACE_SYSTEM_INCLUDE_DIRECTORIES") == 0;
+}
+
+//----------------------------------------------------------------------------
bool cmGeneratorExpressionDAGChecker::EvaluatingCompileDefinitions() const
{
const char *prop = this->Property.c_str();
diff --git a/Source/cmGeneratorExpressionDAGChecker.h b/Source/cmGeneratorExpressionDAGChecker.h
index 95d466a..0b7ef02 100644
--- a/Source/cmGeneratorExpressionDAGChecker.h
+++ b/Source/cmGeneratorExpressionDAGChecker.h
@@ -18,11 +18,13 @@
#define CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD(F) \
F(EvaluatingIncludeDirectories) \
+ F(EvaluatingSystemIncludeDirectories) \
F(EvaluatingCompileDefinitions) \
F(EvaluatingCompileOptions)
#define CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(F) \
F(INTERFACE_INCLUDE_DIRECTORIES) \
+ F(INTERFACE_SYSTEM_INCLUDE_DIRECTORIES) \
F(INTERFACE_COMPILE_DEFINITIONS) \
F(INTERFACE_COMPILE_OPTIONS)
@@ -54,6 +56,10 @@ struct cmGeneratorExpressionDAGChecker
CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD(DECLARE_TRANSITIVE_PROPERTY_METHOD)
+ bool GetTransitivePropertiesOnly();
+ void SetTransitivePropertiesOnly()
+ { this->TransitivePropertiesOnly = true; }
+
private:
Result checkGraph() const;
@@ -65,6 +71,7 @@ private:
const GeneratorExpressionContent * const Content;
const cmListFileBacktrace Backtrace;
Result CheckResult;
+ bool TransitivePropertiesOnly;
};
#endif
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index 05bbc1c..381ef7c 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -492,6 +492,24 @@ static const struct VersionEqualNode : public cmGeneratorExpressionNode
} versionEqualNode;
//----------------------------------------------------------------------------
+static const struct LinkOnlyNode : public cmGeneratorExpressionNode
+{
+ LinkOnlyNode() {}
+
+ std::string Evaluate(const std::vector<std::string> &parameters,
+ cmGeneratorExpressionContext *,
+ const GeneratorExpressionContent *,
+ cmGeneratorExpressionDAGChecker *dagChecker) const
+ {
+ if(!dagChecker->GetTransitivePropertiesOnly())
+ {
+ return parameters.front();
+ }
+ return "";
+ }
+} linkOnlyNode;
+
+//----------------------------------------------------------------------------
static const struct ConfigurationNode : public cmGeneratorExpressionNode
{
ConfigurationNode() {}
@@ -879,6 +897,10 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
{
interfacePropertyName = "INTERFACE_INCLUDE_DIRECTORIES";
}
+ else if (propertyName == "INTERFACE_SYSTEM_INCLUDE_DIRECTORIES")
+ {
+ interfacePropertyName = "INTERFACE_SYSTEM_INCLUDE_DIRECTORIES";
+ }
else if (propertyName == "INTERFACE_COMPILE_DEFINITIONS"
|| propertyName == "COMPILE_DEFINITIONS"
|| strncmp(propertyName.c_str(), "COMPILE_DEFINITIONS_", 20) == 0)
@@ -900,13 +922,14 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
if (std::find_if(transBegin, transEnd,
TransitiveWhitelistCompare(propertyName)) != transEnd)
{
- const cmTarget::LinkInterface *iface = target->GetLinkInterface(
- context->Config,
- headTarget);
- if(iface)
+
+ std::vector<std::string> libs;
+ target->GetTransitivePropertyLinkLibraries(context->Config,
+ headTarget, libs);
+ if (!libs.empty())
{
linkedTargetsContent =
- getLinkedTargetsContent(iface->Libraries, target,
+ getLinkedTargetsContent(libs, target,
headTarget,
context, &dagChecker,
interfacePropertyName);
@@ -1014,10 +1037,13 @@ static const struct TargetNameNode : public cmGeneratorExpressionNode
//----------------------------------------------------------------------------
static const char* targetPolicyWhitelist[] = {
- "CMP0003"
- , "CMP0004"
- , "CMP0008"
- , "CMP0020"
+ 0
+#define TARGET_POLICY_STRING(POLICY) \
+ , #POLICY
+
+ CM_FOR_EACH_TARGET_POLICY(TARGET_POLICY_STRING)
+
+#undef TARGET_POLICY_STRING
};
cmPolicies::PolicyStatus statusForTarget(cmTarget *tgt, const char *policy)
@@ -1028,10 +1054,7 @@ cmPolicies::PolicyStatus statusForTarget(cmTarget *tgt, const char *policy)
return tgt->GetPolicyStatus ## POLICY (); \
} \
- RETURN_POLICY(CMP0003)
- RETURN_POLICY(CMP0004)
- RETURN_POLICY(CMP0008)
- RETURN_POLICY(CMP0020)
+ CM_FOR_EACH_TARGET_POLICY(RETURN_POLICY)
#undef RETURN_POLICY
@@ -1047,10 +1070,7 @@ cmPolicies::PolicyID policyForString(const char *policy_id)
return cmPolicies:: POLICY_ID; \
} \
- RETURN_POLICY_ID(CMP0003)
- RETURN_POLICY_ID(CMP0004)
- RETURN_POLICY_ID(CMP0008)
- RETURN_POLICY_ID(CMP0020)
+ CM_FOR_EACH_TARGET_POLICY(RETURN_POLICY_ID)
#undef RETURN_POLICY_ID
@@ -1080,7 +1100,7 @@ static const struct TargetPolicyNode : public cmGeneratorExpressionNode
context->HadContextSensitiveCondition = true;
- for (size_t i = 0;
+ for (size_t i = 1;
i < (sizeof(targetPolicyWhitelist) /
sizeof(*targetPolicyWhitelist));
++i)
@@ -1106,8 +1126,17 @@ static const struct TargetPolicyNode : public cmGeneratorExpressionNode
}
reportError(context, content->GetOriginalExpression(),
"$<TARGET_POLICY:prop> may only be used with a limited number of "
- "policies. Currently it may be used with policies CMP0003, CMP0004, "
- "CMP0008 and CMP0020."
+ "policies. Currently it may be used with the following policies:\n"
+
+#define STRINGIFY_HELPER(X) #X
+#define STRINGIFY(X) STRINGIFY_HELPER(X)
+
+#define TARGET_POLICY_LIST_ITEM(POLICY) \
+ " * " STRINGIFY(POLICY) "\n"
+
+ CM_FOR_EACH_TARGET_POLICY(TARGET_POLICY_LIST_ITEM)
+
+#undef TARGET_POLICY_LIST_ITEM
);
return std::string();
}
@@ -1395,6 +1424,8 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier)
return &installPrefixNode;
else if (identifier == "JOIN")
return &joinNode;
+ else if (identifier == "LINK_ONLY")
+ return &linkOnlyNode;
return 0;
}
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index f5d1560..5ce0e6b 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -48,6 +48,51 @@ const char *cmGeneratorTarget::GetProperty(const char *prop)
}
//----------------------------------------------------------------------------
+bool cmGeneratorTarget::IsSystemIncludeDirectory(const char *dir,
+ const char *config)
+{
+ std::string config_upper;
+ if(config && *config)
+ {
+ config_upper = cmSystemTools::UpperCase(config);
+ }
+
+ typedef std::map<std::string, std::vector<std::string> > IncludeCacheType;
+ IncludeCacheType::iterator iter =
+ this->SystemIncludesCache.find(config_upper);
+
+ if (iter == this->SystemIncludesCache.end())
+ {
+ std::vector<std::string> result;
+ for (std::set<cmStdString>::const_iterator
+ it = this->Target->GetSystemIncludeDirectories().begin();
+ it != this->Target->GetSystemIncludeDirectories().end(); ++it)
+ {
+ cmListFileBacktrace lfbt;
+ cmGeneratorExpression ge(lfbt);
+
+ cmGeneratorExpressionDAGChecker dagChecker(lfbt,
+ this->GetName(),
+ "INTERFACE_SYSTEM_INCLUDE_DIRECTORIES", 0, 0);
+
+ cmSystemTools::ExpandListArgument(ge.Parse(*it)
+ ->Evaluate(this->Makefile,
+ config, false, this->Target,
+ &dagChecker), result);
+ }
+ IncludeCacheType::value_type entry(config_upper, result);
+ iter = this->SystemIncludesCache.insert(entry).first;
+ }
+
+ if (std::find(iter->second.begin(),
+ iter->second.end(), dir) != iter->second.end())
+ {
+ return true;
+ }
+ return false;
+}
+
+//----------------------------------------------------------------------------
bool cmGeneratorTarget::GetPropertyAsBool(const char *prop)
{
return this->Target->GetPropertyAsBool(prop);
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 5f7019d..dedfa60 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -72,10 +72,14 @@ public:
/** Get the include directories for this target. */
std::vector<std::string> GetIncludeDirectories(const char *config);
+ bool IsSystemIncludeDirectory(const char *dir, const char *config);
+
private:
void ClassifySources();
void LookupObjectLibraries();
+ std::map<std::string, std::vector<std::string> > SystemIncludesCache;
+
cmGeneratorTarget(cmGeneratorTarget const&);
void operator=(cmGeneratorTarget const&);
};
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index ad74767..9b6ac93 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -892,12 +892,28 @@ void cmGlobalGenerator::Configure()
if ( this->CMakeInstance->GetWorkingMode() == cmake::NORMAL_MODE)
{
- const char* msg = "Configuring done";
+ cmOStringStream msg;
if(cmSystemTools::GetErrorOccuredFlag())
{
- msg = "Configuring incomplete, errors occurred!";
+ msg << "Configuring incomplete, errors occurred!";
+ const char* logs[] = {"CMakeOutput.log", "CMakeError.log", 0};
+ for(const char** log = logs; *log; ++log)
+ {
+ std::string f = this->CMakeInstance->GetHomeOutputDirectory();
+ f += this->CMakeInstance->GetCMakeFilesDirectory();
+ f += "/";
+ f += *log;
+ if(cmSystemTools::FileExists(f.c_str()))
+ {
+ msg << "\nSee also \"" << f << "\".";
+ }
+ }
+ }
+ else
+ {
+ msg << "Configuring done";
}
- this->CMakeInstance->UpdateProgress(msg, -1);
+ this->CMakeInstance->UpdateProgress(msg.str().c_str(), -1);
}
}
@@ -1001,6 +1017,17 @@ void cmGlobalGenerator::Generate()
// it builds by default.
this->FillLocalGeneratorToTargetMap();
+ for (i = 0; i < this->LocalGenerators.size(); ++i)
+ {
+ cmMakefile* mf = this->LocalGenerators[i]->GetMakefile();
+ cmTargets* targets = &(mf->GetTargets());
+ for ( cmTargets::iterator it = targets->begin();
+ it != targets->end(); ++ it )
+ {
+ it->second.FinalizeSystemIncludeDirectories();
+ }
+ }
+
// Generate project files
for (i = 0; i < this->LocalGenerators.size(); ++i)
{
@@ -1121,8 +1148,9 @@ void cmGlobalGenerator::CreateGeneratorTargets()
cmGeneratorTargetsType generatorTargets;
cmMakefile *mf = this->LocalGenerators[i]->GetMakefile();
- const char *noconfig_compile_definitions =
- mf->GetProperty("COMPILE_DEFINITIONS");
+
+ const std::vector<cmValueWithOrigin> noconfig_compile_definitions =
+ mf->GetCompileDefinitionsEntries();
std::vector<std::string> configs;
mf->GetConfigurations(configs);
@@ -1134,7 +1162,13 @@ void cmGlobalGenerator::CreateGeneratorTargets()
cmTarget* t = &ti->second;
{
- t->AppendProperty("COMPILE_DEFINITIONS", noconfig_compile_definitions);
+ for (std::vector<cmValueWithOrigin>::const_iterator it
+ = noconfig_compile_definitions.begin();
+ it != noconfig_compile_definitions.end(); ++it)
+ {
+ t->InsertCompileDefinition(*it);
+ }
+
for(std::vector<std::string>::const_iterator ci = configs.begin();
ci != configs.end(); ++ci)
{
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 9cfbe42..63de1a5 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1741,8 +1741,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
this->AppendDefines(ppDefs, exportMacro);
}
cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&target);
- this->AppendDefines(ppDefs,
- target.GetCompileDefinitions(configName).c_str());
+ std::vector<std::string> targetDefines;
+ target.GetCompileDefinitions(targetDefines, configName);
+ this->AppendDefines(ppDefs, targetDefines);
buildSettings->AddAttribute
("GCC_PREPROCESSOR_DEFINITIONS", ppDefs.CreateList());
diff --git a/Source/cmIDEOptions.cxx b/Source/cmIDEOptions.cxx
index 76a60cf..34a9c7c 100644
--- a/Source/cmIDEOptions.cxx
+++ b/Source/cmIDEOptions.cxx
@@ -165,6 +165,11 @@ void cmIDEOptions::AddDefines(const char* defines)
cmSystemTools::ExpandListArgument(defines, this->Defines);
}
}
+//----------------------------------------------------------------------------
+void cmIDEOptions::AddDefines(const std::vector<std::string> &defines)
+{
+ this->Defines.insert(this->Defines.end(), defines.begin(), defines.end());
+}
//----------------------------------------------------------------------------
void cmIDEOptions::AddFlag(const char* flag, const char* value)
diff --git a/Source/cmIDEOptions.h b/Source/cmIDEOptions.h
index e556bde..e78af3e 100644
--- a/Source/cmIDEOptions.h
+++ b/Source/cmIDEOptions.h
@@ -27,6 +27,7 @@ public:
// Store definitions and flags.
void AddDefine(const std::string& define);
void AddDefines(const char* defines);
+ void AddDefines(const std::vector<std::string> &defines);
void AddFlag(const char* flag, const char* value);
void RemoveFlag(const char* flag);
const char* GetFlag(const char* flag);
diff --git a/Source/cmIncludeCommand.h b/Source/cmIncludeCommand.h
index c46c02d..d97b7c3 100644
--- a/Source/cmIncludeCommand.h
+++ b/Source/cmIncludeCommand.h
@@ -55,7 +55,7 @@ public:
*/
virtual const char* GetTerseDocumentation() const
{
- return "Read CMake listfile code from the given file.";
+ return "Load and run CMake code from a file or module.";
}
/**
@@ -66,9 +66,10 @@ public:
return
" include(<file|module> [OPTIONAL] [RESULT_VARIABLE <VAR>]\n"
" [NO_POLICY_SCOPE])\n"
- "Reads CMake listfile code from the given file. Commands in the file "
- "are processed immediately as if they were written in place of the "
- "include command. If OPTIONAL is present, then no error "
+ "Load and run CMake code from the file given. "
+ "Variable reads and writes access the scope of the caller "
+ "(dynamic scoping). "
+ "If OPTIONAL is present, then no error "
"is raised if the file does not exist. If RESULT_VARIABLE is given "
"the variable will be set to the full filename which "
"has been included or NOTFOUND if it failed.\n"
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index dcd418b..d3a8037 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -1196,6 +1196,8 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args)
cmInstallCommandArguments ica(this->DefaultComponentName);
cmCAString exp(&ica.Parser, "EXPORT");
cmCAString name_space(&ica.Parser, "NAMESPACE", &ica.ArgumentGroup);
+ cmCAEnabler exportOld(&ica.Parser, "EXPORT_LINK_INTERFACE_LIBRARIES",
+ &ica.ArgumentGroup);
cmCAString filename(&ica.Parser, "FILE", &ica.ArgumentGroup);
exp.Follows(0);
@@ -1268,15 +1270,40 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args)
}
}
+ cmExportSet *exportSet = this->Makefile->GetLocalGenerator()
+ ->GetGlobalGenerator()->GetExportSets()[exp.GetString()];
+ if (exportOld.IsEnabled())
+ {
+ for(std::vector<cmTargetExport*>::const_iterator
+ tei = exportSet->GetTargetExports()->begin();
+ tei != exportSet->GetTargetExports()->end(); ++tei)
+ {
+ cmTargetExport const* te = *tei;
+ const bool newCMP0022Behavior =
+ te->Target->GetPolicyStatusCMP0022() != cmPolicies::WARN
+ && te->Target->GetPolicyStatusCMP0022() != cmPolicies::OLD;
+
+ if(!newCMP0022Behavior)
+ {
+ cmOStringStream e;
+ e << "INSTALL(EXPORT) given keyword \""
+ << "EXPORT_LINK_INTERFACE_LIBRARIES" << "\", but target \""
+ << te->Target->GetName()
+ << "\" does not have policy CMP0022 set to NEW.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+ }
+ }
+
// Create the export install generator.
cmInstallExportGenerator* exportGenerator =
new cmInstallExportGenerator(
- this->Makefile->GetLocalGenerator()
- ->GetGlobalGenerator()->GetExportSets()[exp.GetString()],
+ exportSet,
ica.GetDestination().c_str(),
ica.GetPermissions().c_str(), ica.GetConfigurations(),
ica.GetComponent().c_str(), fname.c_str(),
- name_space.GetCString(), this->Makefile);
+ name_space.GetCString(), exportOld.IsEnabled(), this->Makefile);
this->Makefile->AddInstallGenerator(exportGenerator);
return true;
diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h
index 7c06009..39acd23 100644
--- a/Source/cmInstallCommand.h
+++ b/Source/cmInstallCommand.h
@@ -291,6 +291,7 @@ public:
" [NAMESPACE <namespace>] [FILE <name>.cmake]\n"
" [PERMISSIONS permissions...]\n"
" [CONFIGURATIONS [Debug|Release|...]]\n"
+ " [EXPORT_LINK_INTERFACE_LIBRARIES]\n"
" [COMPONENT <component>])\n"
"The EXPORT form generates and installs a CMake file containing code "
"to import targets from the installation tree into another project. "
@@ -306,6 +307,10 @@ public:
"installed when one of the named configurations is installed. "
"Additionally, the generated import file will reference only the "
"matching target configurations. "
+ "The EXPORT_LINK_INTERFACE_LIBRARIES keyword, if present, causes the "
+ "contents of the properties matching "
+ "(IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)? to be exported, when "
+ "policy CMP0022 is NEW. "
"If a COMPONENT option is specified that does not match that given "
"to the targets associated with <export-name> the behavior is "
"undefined. "
diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx
index 0a645a8..3e9e6ac 100644
--- a/Source/cmInstallExportGenerator.cxx
+++ b/Source/cmInstallExportGenerator.cxx
@@ -33,12 +33,14 @@ cmInstallExportGenerator::cmInstallExportGenerator(
std::vector<std::string> const& configurations,
const char* component,
const char* filename, const char* name_space,
+ bool exportOld,
cmMakefile* mf)
:cmInstallGenerator(destination, configurations, component)
,ExportSet(exportSet)
,FilePermissions(file_permissions)
,FileName(filename)
,Namespace(name_space)
+ ,ExportOld(exportOld)
,Makefile(mf)
{
this->EFGen = new cmExportInstallFileGenerator(this);
@@ -137,6 +139,7 @@ void cmInstallExportGenerator::GenerateScript(std::ostream& os)
// Generate the import file for this export set.
this->EFGen->SetExportFile(this->MainImportFile.c_str());
this->EFGen->SetNamespace(this->Namespace.c_str());
+ this->EFGen->SetExportOld(this->ExportOld);
if(this->ConfigurationTypes->empty())
{
if(this->ConfigurationName && *this->ConfigurationName)
diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h
index 7aff731..37b5593 100644
--- a/Source/cmInstallExportGenerator.h
+++ b/Source/cmInstallExportGenerator.h
@@ -31,7 +31,7 @@ public:
const std::vector<std::string>& configurations,
const char* component,
const char* filename, const char* name_space,
- cmMakefile* mf);
+ bool exportOld, cmMakefile* mf);
~cmInstallExportGenerator();
cmExportSet* GetExportSet() {return this->ExportSet;}
@@ -52,6 +52,7 @@ protected:
std::string FilePermissions;
std::string FileName;
std::string Namespace;
+ bool ExportOld;
cmMakefile* Makefile;
std::string TempDir;
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index dd9909b..4e871d6 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -571,7 +571,7 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
{
std::vector<std::string> includes;
this->GetIncludeDirectories(includes, &target, lang);
- flags += this->GetIncludeFlags(includes, lang);
+ flags += this->GetIncludeFlags(includes, &target, lang);
}
flags += this->Makefile->GetDefineFlags();
@@ -1218,6 +1218,7 @@ cmLocalGenerator::ConvertToIncludeReference(std::string const& path)
//----------------------------------------------------------------------------
std::string cmLocalGenerator::GetIncludeFlags(
const std::vector<std::string> &includes,
+ cmGeneratorTarget* target,
const char* lang, bool forResponseFile,
const char *config)
{
@@ -1288,11 +1289,10 @@ std::string cmLocalGenerator::GetIncludeFlags(
continue;
}
- std::string include = *i;
if(!flagUsed || repeatFlag)
{
- if(sysIncludeFlag &&
- this->Makefile->IsSystemIncludeDirectory(i->c_str(), config))
+ if(sysIncludeFlag && target &&
+ target->IsSystemIncludeDirectory(i->c_str(), config))
{
includeFlags << sysIncludeFlag;
}
@@ -1333,6 +1333,17 @@ std::string cmLocalGenerator::GetIncludeFlags(
}
//----------------------------------------------------------------------------
+void cmLocalGenerator::AddCompileDefinitions(std::set<std::string>& defines,
+ cmTarget* target,
+ const char* config)
+{
+ std::vector<std::string> targetDefines;
+ target->GetCompileDefinitions(targetDefines,
+ config);
+ this->AppendDefines(defines, targetDefines);
+}
+
+//----------------------------------------------------------------------------
void cmLocalGenerator::AddCompileOptions(
std::string& flags, cmTarget* target,
const char* lang, const char* config
@@ -1461,8 +1472,6 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
return;
}
- std::string rootPath = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT");
-
std::vector<std::string> implicitDirs;
// Load implicit include directories for this language.
std::string impDirVar = "CMAKE_";
@@ -1475,9 +1484,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
for(std::vector<std::string>::const_iterator i = impDirVec.begin();
i != impDirVec.end(); ++i)
{
- std::string d = rootPath + *i;
- cmSystemTools::ConvertToUnixSlashes(d);
- emitted.insert(d);
+ emitted.insert(*i);
if (!stripImplicitInclDirs)
{
implicitDirs.push_back(*i);
@@ -2295,7 +2302,13 @@ void cmLocalGenerator::AppendDefines(std::set<std::string>& defines,
// Expand the list of definitions.
std::vector<std::string> defines_vec;
cmSystemTools::ExpandListArgument(defines_list, defines_vec);
+ this->AppendDefines(defines, defines_vec);
+}
+//----------------------------------------------------------------------------
+void cmLocalGenerator::AppendDefines(std::set<std::string>& defines,
+ const std::vector<std::string> &defines_vec)
+{
for(std::vector<std::string>::const_iterator di = defines_vec.begin();
di != defines_vec.end(); ++di)
{
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 0bd1853..ed0f6e3 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -152,6 +152,7 @@ public:
virtual void AppendFlagEscape(std::string& flags, const char* rawFlag);
///! Get the include flags for the current makefile and language
std::string GetIncludeFlags(const std::vector<std::string> &includes,
+ cmGeneratorTarget* target,
const char* lang, bool forResponseFile = false,
const char *config = 0);
@@ -166,6 +167,9 @@ public:
{
this->AppendDefines(defines, defines_list.c_str());
}
+ void AppendDefines(std::set<std::string>& defines,
+ const std::vector<std::string> &defines_vec);
+
/**
* Join a set of defines into a definesString with a space separator.
*/
@@ -220,6 +224,8 @@ public:
bool stripImplicitInclDirs = true);
void AddCompileOptions(std::string& flags, cmTarget* target,
const char* lang, const char* config);
+ void AddCompileDefinitions(std::set<std::string>& defines, cmTarget* target,
+ const char* config);
/** Compute the language used to compile the given source file. */
const char* GetSourceFileLanguage(const cmSourceFile& source);
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 5966900..56da1f9 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -1961,8 +1961,8 @@ void cmLocalUnixMakefileGenerator3
// Build a list of preprocessor definitions for the target.
std::set<std::string> defines;
- this->AppendDefines(defines, target.GetCompileDefinitions(
- this->ConfigurationName.c_str()));
+ this->AddCompileDefinitions(defines, &target,
+ this->ConfigurationName.c_str());
if(!defines.empty())
{
cmakefileStream
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index 0b61e1d..df6e1f1 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -1701,21 +1701,11 @@ void cmLocalVisualStudio6Generator
std::set<std::string> minsizeDefinesSet;
std::set<std::string> debugrelDefinesSet;
- this->AppendDefines(
- definesSet,
- target.GetCompileDefinitions(0));
- this->AppendDefines(
- debugDefinesSet,
- target.GetCompileDefinitions("DEBUG"));
- this->AppendDefines(
- releaseDefinesSet,
- target.GetCompileDefinitions("RELEASE"));
- this->AppendDefines(
- minsizeDefinesSet,
- target.GetCompileDefinitions("MINSIZEREL"));
- this->AppendDefines(
- debugrelDefinesSet,
- target.GetCompileDefinitions("RELWITHDEBINFO"));
+ this->AddCompileDefinitions(definesSet, &target, 0);
+ this->AddCompileDefinitions(debugDefinesSet, &target, "DEBUG");
+ this->AddCompileDefinitions(releaseDefinesSet, &target, "RELEASE");
+ this->AddCompileDefinitions(minsizeDefinesSet, &target, "MINSIZEREL");
+ this->AddCompileDefinitions(debugrelDefinesSet, &target, "RELWITHDEBINFO");
std::string defines = " ";
std::string debugDefines = " ";
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 1d2f709..9ecd53d 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -746,7 +746,9 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
targetOptions.ParseFinish();
cmGeneratorTarget* gt =
this->GlobalGenerator->GetGeneratorTarget(&target);
- targetOptions.AddDefines(target.GetCompileDefinitions(configName).c_str());
+ std::vector<std::string> targetDefines;
+ target.GetCompileDefinitions(targetDefines, configName);
+ targetOptions.AddDefines(targetDefines);
targetOptions.SetVerboseMakefile(
this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE"));
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index f3a66ba..818a580 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1505,6 +1505,12 @@ void cmMakefile::InitializeFromParent()
parentOptions.begin(),
parentOptions.end());
+ const std::vector<cmValueWithOrigin> parentDefines =
+ parent->GetCompileDefinitionsEntries();
+ this->CompileDefinitionsEntries.insert(this->CompileDefinitionsEntries.end(),
+ parentDefines.begin(),
+ parentDefines.end());
+
this->SystemIncludeDirectories = parent->SystemIncludeDirectories;
// define flags
@@ -1675,27 +1681,13 @@ cmMakefile::AddSystemIncludeDirectories(const std::set<cmStdString> &incs)
{
this->SystemIncludeDirectories.insert(*li);
}
-}
-//----------------------------------------------------------------------------
-bool cmMakefile::IsSystemIncludeDirectory(const char* dir, const char *config)
-{
- for (std::set<cmStdString>::const_iterator
- it = this->SystemIncludeDirectories.begin();
- it != this->SystemIncludeDirectories.end(); ++it)
+ for (cmTargets::iterator l = this->Targets.begin();
+ l != this->Targets.end(); ++l)
{
- cmListFileBacktrace lfbt;
- cmGeneratorExpression ge(lfbt);
-
- std::vector<std::string> incs;
- cmSystemTools::ExpandListArgument(ge.Parse(*it)
- ->Evaluate(this, config, false), incs);
- if (std::find(incs.begin(), incs.end(), dir) != incs.end())
- {
- return true;
- }
+ cmTarget &t = l->second;
+ t.AddSystemIncludeDirectories(incs);
}
- return false;
}
void cmMakefile::AddDefinition(const char* name, const char* value)
@@ -3493,6 +3485,19 @@ void cmMakefile::SetProperty(const char* prop, const char* value)
this->CompileOptionsEntries.push_back(cmValueWithOrigin(value, lfbt));
return;
}
+ if (propname == "COMPILE_DEFINITIONS")
+ {
+ this->CompileDefinitionsEntries.clear();
+ if (!value)
+ {
+ return;
+ }
+ cmListFileBacktrace lfbt;
+ this->GetBacktrace(lfbt);
+ cmValueWithOrigin entry(value, lfbt);
+ this->CompileDefinitionsEntries.push_back(entry);
+ return;
+ }
if ( propname == "INCLUDE_REGULAR_EXPRESSION" )
{
@@ -3540,6 +3545,14 @@ void cmMakefile::AppendProperty(const char* prop, const char* value,
cmValueWithOrigin(value, lfbt));
return;
}
+ if (propname == "COMPILE_DEFINITIONS")
+ {
+ cmListFileBacktrace lfbt;
+ this->GetBacktrace(lfbt);
+ this->CompileDefinitionsEntries.push_back(
+ cmValueWithOrigin(value, lfbt));
+ return;
+ }
if ( propname == "LINK_DIRECTORIES" )
{
std::vector<std::string> varArgsExpanded;
@@ -3679,6 +3692,20 @@ const char *cmMakefile::GetProperty(const char* prop,
}
return output.c_str();
}
+ else if (!strcmp("COMPILE_DEFINITIONS",prop))
+ {
+ std::string sep;
+ for (std::vector<cmValueWithOrigin>::const_iterator
+ it = this->CompileDefinitionsEntries.begin(),
+ end = this->CompileDefinitionsEntries.end();
+ it != end; ++it)
+ {
+ output += sep;
+ output += it->Value;
+ sep = ";";
+ }
+ return output.c_str();
+ }
bool chain = false;
const char *retVal =
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 4297155..871fa1b 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -871,10 +871,17 @@ public:
{
return this->CompileOptionsEntries;
}
+ std::vector<cmValueWithOrigin> GetCompileDefinitionsEntries() const
+ {
+ return this->CompileDefinitionsEntries;
+ }
bool IsGeneratingBuildSystem(){ return this->GeneratingBuildSystem; }
void SetGeneratingBuildSystem(){ this->GeneratingBuildSystem = true; }
+ std::set<cmStdString> const & GetSystemIncludeDirectories() const
+ { return this->SystemIncludeDirectories; }
+
protected:
// add link libraries and directories to the target
void AddGlobalLinkInformation(const char* name, cmTarget& target);
@@ -925,6 +932,7 @@ protected:
std::vector<cmValueWithOrigin> IncludeDirectoriesEntries;
std::vector<cmValueWithOrigin> CompileOptionsEntries;
+ std::vector<cmValueWithOrigin> CompileDefinitionsEntries;
// Track the value of the computed DEFINITIONS property.
void AddDefineFlag(const char*, std::string&);
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 271183e..e4219a9 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -365,22 +365,6 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
vars.TargetVersionMajor = targetVersionMajor.c_str();
vars.TargetVersionMinor = targetVersionMinor.c_str();
- if (const char *rootPath =
- this->Makefile->GetDefinition("CMAKE_SYSROOT"))
- {
- if (*rootPath)
- {
- if (const char *sysrootFlag =
- this->Makefile->GetDefinition("CMAKE_SYSROOT_FLAG"))
- {
- flags += " ";
- flags += sysrootFlag;
- flags += this->LocalGenerator->EscapeForShell(rootPath);
- flags += " ";
- }
- }
- }
-
vars.LinkLibraries = linkLibs.c_str();
vars.Flags = flags.c_str();
vars.LinkFlags = linkFlags.c_str();
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 36d1a5a..347f26d 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -589,26 +589,6 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
cmLocalGenerator::SHELL);
vars.ObjectDir = objdir.c_str();
vars.Target = targetOutPathReal.c_str();
-
- if(this->Target->GetType() == cmTarget::SHARED_LIBRARY)
- {
- if (const char *rootPath =
- this->Makefile->GetSafeDefinition("CMAKE_SYSROOT"))
- {
- if (*rootPath)
- {
- if (const char *sysrootFlag =
- this->Makefile->GetDefinition("CMAKE_SYSROOT_FLAG"))
- {
- linkFlags += " ";
- linkFlags += sysrootFlag;
- linkFlags += this->LocalGenerator->EscapeForShell(rootPath);
- linkFlags += " ";
- }
- }
- }
- }
-
vars.LinkLibraries = linkLibs.c_str();
vars.ObjectsQuoted = buildObjs.c_str();
if (this->Target->HasSOName(this->ConfigName))
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 1492dfa..0829cab 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -309,9 +309,8 @@ std::string cmMakefileTargetGenerator::GetDefines(const std::string &l)
}
// Add preprocessor definitions for this target and configuration.
- this->LocalGenerator->AppendDefines
- (defines, this->Target->GetCompileDefinitions(
- this->LocalGenerator->ConfigurationName.c_str()));
+ this->LocalGenerator->AddCompileDefinitions(defines, this->Target,
+ this->LocalGenerator->ConfigurationName.c_str());
std::string definesString;
this->LocalGenerator->JoinDefines(defines, definesString, lang);
@@ -644,23 +643,6 @@ cmMakefileTargetGenerator
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::SHELL);
vars.ObjectDir = objectDir.c_str();
-
- if (const char *rootPath =
- this->Makefile->GetSafeDefinition("CMAKE_SYSROOT"))
- {
- if (*rootPath)
- {
- if (const char *sysrootFlag =
- this->Makefile->GetDefinition("CMAKE_SYSROOT_FLAG"))
- {
- flags += " ";
- flags += sysrootFlag;
- flags += this->LocalGenerator->EscapeForShell(rootPath);
- flags += " ";
- }
- }
- }
-
vars.Flags = flags.c_str();
std::string definesString = "$(";
@@ -1853,7 +1835,8 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags,
lang, config);
std::string includeFlags =
- this->LocalGenerator->GetIncludeFlags(includes, lang, useResponseFile);
+ this->LocalGenerator->GetIncludeFlags(includes, this->GeneratorTarget,
+ lang, useResponseFile);
if(includeFlags.empty())
{
return;
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 921ca92..fa7e396 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -224,27 +224,7 @@ cmNinjaNormalTargetGenerator
vars.TargetVersionMajor = targetVersionMajor.c_str();
vars.TargetVersionMinor = targetVersionMinor.c_str();
-
- std::string flags = "$FLAGS";
-
- if (const char *rootPath =
- this->GetMakefile()->GetSafeDefinition("CMAKE_SYSROOT"))
- {
- if (*rootPath)
- {
- if (const char *sysrootFlag =
- this->GetMakefile()->GetDefinition("CMAKE_SYSROOT_FLAG"))
- {
- flags += " ";
- flags += sysrootFlag;
- flags += this->GetLocalGenerator()->EscapeForShell(rootPath);
- flags += " ";
- }
- }
- }
-
- vars.Flags = flags.c_str();
-
+ vars.Flags = "$FLAGS";
vars.LinkFlags = "$LINK_FLAGS";
std::string langFlags;
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 65173ca..898aa0e 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -161,7 +161,8 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile *source,
this->GeneratorTarget,
language.c_str(), config);
std::string includeFlags =
- this->LocalGenerator->GetIncludeFlags(includes, language.c_str(),
+ this->LocalGenerator->GetIncludeFlags(includes, this->GeneratorTarget,
+ language.c_str(),
language == "RC" ? true : false); // full include paths for RC
// needed by cmcldeps
if(cmGlobalNinjaGenerator::IsMinGW())
@@ -201,9 +202,8 @@ ComputeDefines(cmSourceFile *source, const std::string& language)
}
// Add preprocessor definitions for this target and configuration.
- this->LocalGenerator->AppendDefines
- (defines,
- this->Target->GetCompileDefinitions(this->GetConfigName()));
+ this->LocalGenerator->AddCompileDefinitions(defines, this->Target,
+ this->GetConfigName());
this->LocalGenerator->AppendDefines
(defines,
source->GetProperty("COMPILE_DEFINITIONS"));
@@ -384,23 +384,7 @@ cmNinjaTargetGenerator
cmSystemTools::ReplaceString(depFlagsStr, "<CMAKE_C_COMPILER>",
mf->GetDefinition("CMAKE_C_COMPILER"));
flags += " " + depFlagsStr;
-
- if (const char *rootPath =
- this->Makefile->GetSafeDefinition("CMAKE_SYSROOT"))
- {
- if (*rootPath)
- {
- if (const char *sysrootFlag =
- this->Makefile->GetDefinition("CMAKE_SYSROOT_FLAG"))
- {
- flags += " ";
- flags += sysrootFlag;
- flags += this->LocalGenerator->EscapeForShell(rootPath);
- flags += " ";
- }
- }
- }
- }
+ }
vars.Flags = flags.c_str();
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 32829a6..70c28d4 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -544,6 +544,37 @@ cmPolicies::cmPolicies()
"The NEW behavior for this policy is to issue a FATAL_ERROR if "
"INCLUDE_DIRECTORIES contains a relative path.",
2,8,11,20130516, cmPolicies::WARN);
+
+ this->DefinePolicy(
+ CMP0022, "CMP0022",
+ "INTERFACE_LINK_LIBRARIES defines the link interface.",
+ "CMake 2.8.11 constructed the 'link interface' of a target from "
+ "properties matching (IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?. "
+ "The modern way to specify config-sensitive content is to use generator "
+ "expressions and the IMPORTED_ prefix makes uniform processing of the "
+ "link interface with generator expressions impossible. The "
+ "INTERFACE_LINK_LIBRARIES target property was introduced as a "
+ "replacement in CMake 2.8.12. This new property is named consistently "
+ "with the INTERFACE_COMPILE_DEFINITIONS, INTERFACE_INCLUDE_DIRECTORIES "
+ "and INTERFACE_COMPILE_OPTIONS properties. For in-build targets, CMake "
+ "will use the INTERFACE_LINK_LIBRARIES property as the source of the "
+ "link interface only if policy CMP0022 is NEW. "
+ "When exporting a target which has this policy set to NEW, only the "
+ "INTERFACE_LINK_LIBRARIES property will be processed and generated for "
+ "the IMPORTED target by default. A new option to the install(EXPORT) "
+ "and export commands allows export of the old-style properties for "
+ "compatibility with 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."
+ "\n"
+ "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 "
+ "property for in-build targets, and ignore the old properties matching "
+ "(IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?.",
+ 2,8,11,20130516, cmPolicies::WARN);
}
cmPolicies::~cmPolicies()
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index a033e87..20c953f 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -72,6 +72,7 @@ public:
CMP0020, ///< Automatically link Qt executables to qtmain target
CMP0021, ///< Fatal error on relative paths in INCLUDE_DIRECTORIES
/// target property
+ CMP0022, ///< INTERFACE_LINK_LIBRARIES defines the link interface
/** \brief Always the last entry.
*
diff --git a/Source/cmProjectCommand.h b/Source/cmProjectCommand.h
index a53cb3f..9547c4c 100644
--- a/Source/cmProjectCommand.h
+++ b/Source/cmProjectCommand.h
@@ -71,7 +71,13 @@ public:
"language \"NONE\" all checks for any language can be disabled. "
"If a variable exists called CMAKE_PROJECT_<projectName>_INCLUDE, "
"the file pointed to by that variable will be included as the last step "
- "of the project command.";
+ "of the project command."
+ "\n"
+ "The top-level CMakeLists.txt file for a project must contain a "
+ "literal, direct call to the project() command; loading one through "
+ "the include() command is not sufficient. "
+ "If no such call exists CMake will implicitly add one to the top that "
+ "enables the default languages (C and CXX).";
}
cmTypeMacro(cmProjectCommand, cmCommand);
diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx
index 34b3c7e..93e39ab 100644
--- a/Source/cmQtAutomoc.cxx
+++ b/Source/cmQtAutomoc.cxx
@@ -175,15 +175,17 @@ static void GetCompileDefinitionsAndDirectories(cmTarget *target,
incs += *incDirIt;
}
- defs = target->GetCompileDefinitions(config);
+ std::set<std::string> defines;
+ localGen->AddCompileDefinitions(defines, target, config);
- const char *tmp = makefile->GetProperty("COMPILE_DEFINITIONS");
sep = "";
- if (tmp)
+ for(std::set<std::string>::const_iterator defIt = defines.begin();
+ defIt != defines.end();
+ ++defIt)
{
defs += sep;
sep = ";";
- defs += tmp;
+ defs += *defIt;
}
}
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index aa5fc94..c52c266 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -1696,6 +1696,7 @@ cmSystemTools::SaveRestoreEnvironment::~SaveRestoreEnvironment()
void cmSystemTools::EnableVSConsoleOutput()
{
+#ifdef _WIN32
// Visual Studio 8 2005 (devenv.exe or VCExpress.exe) will not
// display output to the console unless this environment variable is
// set. We need it to capture the output of these build tools.
@@ -1703,8 +1704,15 @@ void cmSystemTools::EnableVSConsoleOutput()
// either of these executables where NAME is created with
// CreateNamedPipe. This would bypass the internal buffering of the
// output and allow it to be captured on the fly.
-#ifdef _WIN32
cmSystemTools::PutEnv("vsconsoleoutput=1");
+
+# ifdef CMAKE_BUILD_WITH_CMAKE
+ // VS sets an environment variable to tell MS tools like "cl" to report
+ // output through a backdoor pipe instead of stdout/stderr. Unset the
+ // environment variable to close this backdoor for any path of process
+ // invocations that passes through CMake so we can capture the output.
+ cmSystemTools::UnsetEnv("VS_UNICODE_OUTPUT");
+# endif
#endif
}
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 1ffca97..70500cd 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -141,13 +141,15 @@ public:
};
std::vector<TargetPropertyEntry*> IncludeDirectoriesEntries;
std::vector<TargetPropertyEntry*> CompileOptionsEntries;
+ std::vector<TargetPropertyEntry*> CompileDefinitionsEntries;
std::vector<cmValueWithOrigin> LinkInterfacePropertyEntries;
std::map<std::string, std::vector<TargetPropertyEntry*> >
CachedLinkInterfaceIncludeDirectoriesEntries;
std::map<std::string, std::vector<TargetPropertyEntry*> >
CachedLinkInterfaceCompileOptionsEntries;
- std::map<std::string, std::string> CachedLinkInterfaceCompileDefinitions;
+ std::map<std::string, std::vector<TargetPropertyEntry*> >
+ CachedLinkInterfaceCompileDefinitionsEntries;
std::map<std::string, bool> CacheLinkInterfaceIncludeDirectoriesDone;
std::map<std::string, bool> CacheLinkInterfaceCompileDefinitionsDone;
@@ -186,17 +188,20 @@ cmTargetInternals::~cmTargetInternals()
{
deleteAndClear(this->CachedLinkInterfaceIncludeDirectoriesEntries);
deleteAndClear(this->CachedLinkInterfaceCompileOptionsEntries);
+ deleteAndClear(this->CachedLinkInterfaceCompileDefinitionsEntries);
}
//----------------------------------------------------------------------------
cmTarget::cmTarget()
{
+#define INITIALIZE_TARGET_POLICY_MEMBER(POLICY) \
+ this->PolicyStatus ## POLICY = cmPolicies::WARN;
+
+ CM_FOR_EACH_TARGET_POLICY(INITIALIZE_TARGET_POLICY_MEMBER)
+
+#undef INITIALIZE_TARGET_POLICY_MEMBER
+
this->Makefile = 0;
- this->PolicyStatusCMP0003 = cmPolicies::WARN;
- this->PolicyStatusCMP0004 = cmPolicies::WARN;
- this->PolicyStatusCMP0008 = cmPolicies::WARN;
- this->PolicyStatusCMP0020 = cmPolicies::WARN;
- this->PolicyStatusCMP0021 = cmPolicies::WARN;
this->LinkLibrariesAnalyzed = false;
this->HaveInstallRule = false;
this->DLLPlatform = false;
@@ -205,6 +210,7 @@ cmTarget::cmTarget()
this->BuildInterfaceIncludesAppended = false;
this->DebugIncludesDone = false;
this->DebugCompileOptionsDone = false;
+ this->DebugCompileDefinitionsDone = false;
}
//----------------------------------------------------------------------------
@@ -474,7 +480,7 @@ void cmTarget::DefineProperties(cmake *cm)
"imported library. "
"The list "
"should be disjoint from the list of interface libraries in the "
- "IMPORTED_LINK_INTERFACE_LIBRARIES property. On platforms requiring "
+ "INTERFACE_LINK_LIBRARIES property. On platforms requiring "
"dependent shared libraries to be found at link time CMake uses this "
"list to add appropriate files or paths to the link command line. "
"Ignored for non-imported targets.");
@@ -495,7 +501,10 @@ void cmTarget::DefineProperties(cmake *cm)
"The libraries will be included on the link line for the target. "
"Unlike the LINK_INTERFACE_LIBRARIES property, this property applies "
"to all imported target types, including STATIC libraries. "
- "This property is ignored for non-imported targets.");
+ "This property is ignored for non-imported targets.\n"
+ "This property is ignored if the target also has a non-empty "
+ "INTERFACE_LINK_LIBRARIES property.\n"
+ "This property is deprecated. Use INTERFACE_LINK_LIBRARIES instead.");
cm->DefineProperty
("IMPORTED_LINK_INTERFACE_LIBRARIES_<CONFIG>", cmProperty::TARGET,
@@ -503,7 +512,10 @@ void cmTarget::DefineProperties(cmake *cm)
"Configuration names correspond to those provided by the project "
"from which the target is imported. "
"If set, this property completely overrides the generic property "
- "for the named configuration.");
+ "for the named configuration.\n"
+ "This property is ignored if the target also has a non-empty "
+ "INTERFACE_LINK_LIBRARIES property.\n"
+ "This property is deprecated. Use INTERFACE_LINK_LIBRARIES instead.");
cm->DefineProperty
("IMPORTED_LINK_INTERFACE_LANGUAGES", cmProperty::TARGET,
@@ -820,7 +832,10 @@ void cmTarget::DefineProperties(cmake *cm)
"This property is initialized by the value of the variable "
"CMAKE_LINK_INTERFACE_LIBRARIES if it is set when a target is "
"created. "
- "This property is ignored for STATIC libraries.");
+ "This property is ignored for STATIC libraries.\n"
+ "This property is overriden by the INTERFACE_LINK_LIBRARIES property if "
+ "policy CMP0022 is NEW.\n"
+ "This property is deprecated. Use INTERFACE_LINK_LIBRARIES instead.");
cm->DefineProperty
("LINK_INTERFACE_LIBRARIES_<CONFIG>", cmProperty::TARGET,
@@ -828,7 +843,23 @@ void cmTarget::DefineProperties(cmake *cm)
"This is the configuration-specific version of "
"LINK_INTERFACE_LIBRARIES. "
"If set, this property completely overrides the generic property "
- "for the named configuration.");
+ "for the named configuration.\n"
+ "This property is overriden by the INTERFACE_LINK_LIBRARIES property if "
+ "policy CMP0022 is NEW.\n"
+ "This property is deprecated. Use INTERFACE_LINK_LIBRARIES instead.");
+
+ cm->DefineProperty
+ ("INTERFACE_LINK_LIBRARIES", cmProperty::TARGET,
+ "List public interface libraries for a shared library or executable.",
+ "This property contains the list of transitive link dependencies. "
+ "When the target is linked into another target the libraries "
+ "listed (and recursively their link interface libraries) will be "
+ "provided to the other target also. "
+ "This property is overriden by the LINK_INTERFACE_LIBRARIES or "
+ "LINK_INTERFACE_LIBRARIES_<CONFIG> property if "
+ "policy CMP0022 is OLD or unset.\n"
+ "\n"
+ CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS);
cm->DefineProperty
("INTERFACE_INCLUDE_DIRECTORIES", cmProperty::TARGET,
@@ -843,6 +874,17 @@ void cmTarget::DefineProperties(cmake *cm)
CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS);
cm->DefineProperty
+ ("SYSTEM_INTERFACE_INCLUDE_DIRECTORIES", cmProperty::TARGET,
+ "List of public system include directories for a library.",
+ "Targets may populate this property to publish the include directories "
+ "which contain system headers, and therefore should not result in "
+ "compiler warnings. Consuming targets will then mark the same include "
+ "directories as system headers."
+ "\n"
+ CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS
+ CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS);
+
+ cm->DefineProperty
("INTERFACE_COMPILE_DEFINITIONS", cmProperty::TARGET,
"List of public compile definitions for a library.",
"Targets may populate this property to publish the compile definitions "
@@ -1647,6 +1689,17 @@ void cmTarget::SetMakefile(cmMakefile* mf)
{
this->InsertInclude(*it);
}
+
+ const std::set<cmStdString> parentSystemIncludes =
+ this->Makefile->GetSystemIncludeDirectories();
+
+ for (std::set<cmStdString>::const_iterator it
+ = parentSystemIncludes.begin();
+ it != parentSystemIncludes.end(); ++it)
+ {
+ this->SystemIncludeDirectories.insert(*it);
+ }
+
const std::vector<cmValueWithOrigin> parentOptions =
this->Makefile->GetCompileOptionsEntries();
@@ -1668,16 +1721,13 @@ void cmTarget::SetMakefile(cmMakefile* mf)
this->SetPropertyDefault("POSITION_INDEPENDENT_CODE", 0);
// Record current policies for later use.
- this->PolicyStatusCMP0003 =
- this->Makefile->GetPolicyStatus(cmPolicies::CMP0003);
- this->PolicyStatusCMP0004 =
- this->Makefile->GetPolicyStatus(cmPolicies::CMP0004);
- this->PolicyStatusCMP0008 =
- this->Makefile->GetPolicyStatus(cmPolicies::CMP0008);
- this->PolicyStatusCMP0020 =
- this->Makefile->GetPolicyStatus(cmPolicies::CMP0020);
- this->PolicyStatusCMP0021 =
- this->Makefile->GetPolicyStatus(cmPolicies::CMP0021);
+#define CAPTURE_TARGET_POLICY(POLICY) \
+ this->PolicyStatus ## POLICY = \
+ this->Makefile->GetPolicyStatus(cmPolicies::POLICY);
+
+ CM_FOR_EACH_TARGET_POLICY(CAPTURE_TARGET_POLICY)
+
+#undef CAPTURE_TARGET_POLICY
}
//----------------------------------------------------------------------------
@@ -2284,6 +2334,14 @@ void cmTarget::MergeLinkLibraries( cmMakefile& mf,
{
// We call this so that the dependencies get written to the cache
this->AddLinkLibrary( mf, selfname, i->first.c_str(), i->second );
+
+ if (this->GetType() == cmTarget::STATIC_LIBRARY)
+ {
+ this->AppendProperty("INTERFACE_LINK_LIBRARIES",
+ ("$<LINK_ONLY:" +
+ this->GetDebugGeneratorExpressions(i->first.c_str(), i->second) +
+ ">").c_str());
+ }
}
this->PrevLinkedLibraries = libs;
}
@@ -2515,6 +2573,61 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf,
//----------------------------------------------------------------------------
void
+cmTarget::AddSystemIncludeDirectories(const std::set<cmStdString> &incs)
+{
+ for(std::set<cmStdString>::const_iterator li = incs.begin();
+ li != incs.end(); ++li)
+ {
+ this->SystemIncludeDirectories.insert(*li);
+ }
+}
+
+//----------------------------------------------------------------------------
+void
+cmTarget::AddSystemIncludeDirectories(const std::vector<std::string> &incs)
+{
+ for(std::vector<std::string>::const_iterator li = incs.begin();
+ li != incs.end(); ++li)
+ {
+ this->SystemIncludeDirectories.insert(*li);
+ }
+}
+
+//----------------------------------------------------------------------------
+void cmTarget::FinalizeSystemIncludeDirectories()
+{
+ for (std::vector<cmValueWithOrigin>::const_iterator
+ it = this->Internal->LinkInterfacePropertyEntries.begin(),
+ end = this->Internal->LinkInterfacePropertyEntries.end();
+ it != end; ++it)
+ {
+ {
+ cmListFileBacktrace lfbt;
+ cmGeneratorExpression ge(lfbt);
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
+ ge.Parse(it->Value);
+ std::string targetName = cge->Evaluate(this->Makefile, 0,
+ false, this, 0, 0);
+ if (!this->Makefile->FindTargetToUse(targetName.c_str()))
+ {
+ continue;
+ }
+ }
+ std::string includeGenex = "$<TARGET_PROPERTY:" +
+ it->Value + ",INTERFACE_SYSTEM_INCLUDE_DIRECTORIES>";
+ if (cmGeneratorExpression::Find(it->Value) != std::string::npos)
+ {
+ // Because it->Value is a generator expression, ensure that it
+ // evaluates to the non-empty string before being used in the
+ // TARGET_PROPERTY expression.
+ includeGenex = "$<$<BOOL:" + it->Value + ">:" + includeGenex + ">";
+ }
+ this->SystemIncludeDirectories.insert(includeGenex);
+ }
+}
+
+//----------------------------------------------------------------------------
+void
cmTarget::AnalyzeLibDependencies( const cmMakefile& mf )
{
// There are two key parts of the dependency analysis: (1)
@@ -2836,6 +2949,17 @@ void cmTarget::SetProperty(const char* prop, const char* value)
new cmTargetInternals::TargetPropertyEntry(cge));
return;
}
+ if(strcmp(prop,"COMPILE_DEFINITIONS") == 0)
+ {
+ cmListFileBacktrace lfbt;
+ this->Makefile->GetBacktrace(lfbt);
+ cmGeneratorExpression ge(lfbt);
+ deleteAndClear(this->Internal->CompileDefinitionsEntries);
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value);
+ this->Internal->CompileDefinitionsEntries.push_back(
+ new cmTargetInternals::TargetPropertyEntry(cge));
+ return;
+ }
if(strcmp(prop,"EXPORT_NAME") == 0 && this->IsImported())
{
cmOStringStream e;
@@ -2887,6 +3011,15 @@ void cmTarget::AppendProperty(const char* prop, const char* value,
new cmTargetInternals::TargetPropertyEntry(ge.Parse(value)));
return;
}
+ if(strcmp(prop,"COMPILE_DEFINITIONS") == 0)
+ {
+ cmListFileBacktrace lfbt;
+ this->Makefile->GetBacktrace(lfbt);
+ cmGeneratorExpression ge(lfbt);
+ this->Internal->CompileDefinitionsEntries.push_back(
+ new cmTargetInternals::TargetPropertyEntry(ge.Parse(value)));
+ return;
+ }
if(strcmp(prop,"EXPORT_NAME") == 0 && this->IsImported())
{
cmOStringStream e;
@@ -2991,6 +3124,20 @@ void cmTarget::InsertCompileOption(const cmValueWithOrigin &entry,
}
//----------------------------------------------------------------------------
+void cmTarget::InsertCompileDefinition(const cmValueWithOrigin &entry,
+ bool before)
+{
+ cmGeneratorExpression ge(entry.Backtrace);
+
+ std::vector<cmTargetInternals::TargetPropertyEntry*>::iterator position
+ = before ? this->Internal->CompileDefinitionsEntries.begin()
+ : this->Internal->CompileDefinitionsEntries.end();
+
+ this->Internal->CompileDefinitionsEntries.insert(position,
+ new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry.Value)));
+}
+
+//----------------------------------------------------------------------------
static void processIncludeDirectories(cmTarget *tgt,
const std::vector<cmTargetInternals::TargetPropertyEntry*> &entries,
std::vector<std::string> &includes,
@@ -3222,12 +3369,12 @@ std::vector<std::string> cmTarget::GetIncludeDirectories(const char *config)
}
//----------------------------------------------------------------------------
-static void processCompileOptions(cmTarget *tgt,
+static void processCompileOptionsInternal(cmTarget *tgt,
const std::vector<cmTargetInternals::TargetPropertyEntry*> &entries,
std::vector<std::string> &options,
std::set<std::string> &uniqueOptions,
cmGeneratorExpressionDAGChecker *dagChecker,
- const char *config, bool debugOptions)
+ const char *config, bool debugOptions, const char *logName)
{
cmMakefile *mf = tgt->GetMakefile();
@@ -3272,7 +3419,8 @@ static void processCompileOptions(cmTarget *tgt,
if (!usedOptions.empty())
{
mf->GetCMakeInstance()->IssueMessage(cmake::LOG,
- std::string("Used compile options for target ")
+ std::string("Used compile ") + logName
+ + std::string(" for target ")
+ tgt->GetName() + ":\n"
+ usedOptions, (*it)->ge->GetBacktrace());
}
@@ -3280,6 +3428,18 @@ static void processCompileOptions(cmTarget *tgt,
}
//----------------------------------------------------------------------------
+static void processCompileOptions(cmTarget *tgt,
+ const std::vector<cmTargetInternals::TargetPropertyEntry*> &entries,
+ std::vector<std::string> &options,
+ std::set<std::string> &uniqueOptions,
+ cmGeneratorExpressionDAGChecker *dagChecker,
+ const char *config, bool debugOptions)
+{
+ processCompileOptionsInternal(tgt, entries, options, uniqueOptions,
+ dagChecker, config, debugOptions, "options");
+}
+
+//----------------------------------------------------------------------------
void cmTarget::GetCompileOptions(std::vector<std::string> &result,
const char *config)
{
@@ -3375,90 +3535,128 @@ void cmTarget::GetCompileOptions(std::vector<std::string> &result,
}
//----------------------------------------------------------------------------
-std::string cmTarget::GetCompileDefinitions(const char *config)
+static void processCompileDefinitions(cmTarget *tgt,
+ const std::vector<cmTargetInternals::TargetPropertyEntry*> &entries,
+ std::vector<std::string> &options,
+ std::set<std::string> &uniqueOptions,
+ cmGeneratorExpressionDAGChecker *dagChecker,
+ const char *config, bool debugOptions)
{
- const char *configProp = 0;
- if (config)
- {
- std::string configPropName;
- configPropName = "COMPILE_DEFINITIONS_" + cmSystemTools::UpperCase(config);
- configProp = this->GetProperty(configPropName.c_str());
- }
+ processCompileOptionsInternal(tgt, entries, options, uniqueOptions,
+ dagChecker, config, debugOptions,
+ "definitions");
+}
- const char *noconfigProp = this->GetProperty("COMPILE_DEFINITIONS");
+//----------------------------------------------------------------------------
+void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
+ const char *config)
+{
+ std::set<std::string> uniqueOptions;
cmListFileBacktrace lfbt;
+
cmGeneratorExpressionDAGChecker dagChecker(lfbt,
- this->GetName(),
- "COMPILE_DEFINITIONS", 0, 0);
+ this->GetName(),
+ "COMPILE_DEFINITIONS", 0, 0);
- std::string defsString = (noconfigProp ? noconfigProp : "");
- if (configProp && noconfigProp)
+ std::vector<std::string> debugProperties;
+ const char *debugProp =
+ this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
+ if (debugProp)
{
- defsString += ";";
+ cmSystemTools::ExpandListArgument(debugProp, debugProperties);
}
- defsString += (configProp ? configProp : "");
- cmGeneratorExpression ge(lfbt);
- std::string result = ge.Parse(defsString.c_str())->Evaluate(this->Makefile,
- config,
- false,
- this,
- &dagChecker);
-
- std::vector<std::string> libs;
- this->GetDirectLinkLibraries(config, libs, this);
+ bool debugDefines = !this->DebugCompileDefinitionsDone
+ && std::find(debugProperties.begin(),
+ debugProperties.end(),
+ "COMPILE_DEFINITIONS")
+ != debugProperties.end();
- if (libs.empty())
+ if (this->Makefile->IsGeneratingBuildSystem())
{
- return result;
+ this->DebugCompileDefinitionsDone = true;
}
- std::string sep;
- std::string depString;
- for (std::vector<std::string>::const_iterator it = libs.begin();
- it != libs.end(); ++it)
- {
- if ((cmGeneratorExpression::IsValidTargetName(it->c_str())
- || cmGeneratorExpression::Find(it->c_str()) != std::string::npos)
- && this->Makefile->FindTargetToUse(it->c_str()))
- {
- depString += sep + "$<TARGET_PROPERTY:"
- + *it + ",INTERFACE_COMPILE_DEFINITIONS>";
- sep = ";";
- }
- }
+ processCompileDefinitions(this,
+ this->Internal->CompileDefinitionsEntries,
+ list,
+ uniqueOptions,
+ &dagChecker,
+ config,
+ debugDefines);
std::string configString = config ? config : "";
if (!this->Internal->CacheLinkInterfaceCompileDefinitionsDone[configString])
{
- cmGeneratorExpression ge2(lfbt);
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge2 =
- ge2.Parse(depString);
- this->Internal->CachedLinkInterfaceCompileDefinitions[configString] =
- cge2->Evaluate(this->Makefile,
- config,
- false,
- this,
- &dagChecker);
- }
- if (!this->Internal->CachedLinkInterfaceCompileDefinitions[configString]
- .empty())
- {
- result += (result.empty() ? "" : ";")
- + this->Internal->CachedLinkInterfaceCompileDefinitions[configString];
+ for (std::vector<cmValueWithOrigin>::const_iterator
+ it = this->Internal->LinkInterfacePropertyEntries.begin(),
+ end = this->Internal->LinkInterfacePropertyEntries.end();
+ it != end; ++it)
+ {
+ {
+ cmGeneratorExpression ge(lfbt);
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
+ ge.Parse(it->Value);
+ std::string targetResult = cge->Evaluate(this->Makefile, config,
+ false, this, 0, 0);
+ if (!this->Makefile->FindTargetToUse(targetResult.c_str()))
+ {
+ continue;
+ }
+ }
+ std::string defsGenex = "$<TARGET_PROPERTY:" +
+ it->Value + ",INTERFACE_COMPILE_DEFINITIONS>";
+ if (cmGeneratorExpression::Find(it->Value) != std::string::npos)
+ {
+ // Because it->Value is a generator expression, ensure that it
+ // evaluates to the non-empty string before being used in the
+ // TARGET_PROPERTY expression.
+ defsGenex = "$<$<BOOL:" + it->Value + ">:" + defsGenex + ">";
+ }
+ cmGeneratorExpression ge(it->Backtrace);
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(
+ defsGenex);
+
+ this->Internal
+ ->CachedLinkInterfaceCompileDefinitionsEntries[configString].push_back(
+ new cmTargetInternals::TargetPropertyEntry(cge,
+ it->Value));
+ }
+ if (config)
+ {
+ std::string configPropName = "COMPILE_DEFINITIONS_"
+ + cmSystemTools::UpperCase(config);
+ const char *configProp = this->GetProperty(configPropName.c_str());
+ std::string defsString = (configProp ? configProp : "");
+
+ cmGeneratorExpression ge(lfbt);
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
+ ge.Parse(defsString);
+ this->Internal
+ ->CachedLinkInterfaceCompileDefinitionsEntries[configString].push_back(
+ new cmTargetInternals::TargetPropertyEntry(cge));
+ }
+
}
+ processCompileDefinitions(this,
+ this->Internal->CachedLinkInterfaceCompileDefinitionsEntries[configString],
+ list,
+ uniqueOptions,
+ &dagChecker,
+ config,
+ debugDefines);
+
if (!this->Makefile->IsGeneratingBuildSystem())
{
- this->Internal->CachedLinkInterfaceCompileDefinitions[configString] = "";
+ deleteAndClear(this->Internal
+ ->CachedLinkInterfaceCompileDefinitionsEntries);
}
else
{
this->Internal->CacheLinkInterfaceCompileDefinitionsDone[configString]
= true;
}
-
- return result;
}
//----------------------------------------------------------------------------
@@ -3519,6 +3717,29 @@ static void cmTargetCheckLINK_INTERFACE_LIBRARIES(
}
//----------------------------------------------------------------------------
+static void cmTargetCheckINTERFACE_LINK_LIBRARIES(const char* value,
+ cmMakefile* context)
+{
+ // Look for link-type keywords in the value.
+ static cmsys::RegularExpression
+ keys("(^|;)(debug|optimized|general)(;|$)");
+ if(!keys.find(value))
+ {
+ return;
+ }
+
+ // Report an error.
+ cmOStringStream e;
+
+ e << "Property INTERFACE_LINK_LIBRARIES may not contain link-type "
+ "keyword \"" << keys.match(2) << "\". The INTERFACE_LINK_LIBRARIES "
+ "property may contain configuration-sensitive generator-expressions "
+ "which may be used to specify per-configuration rules.";
+
+ context->IssueMessage(cmake::FATAL_ERROR, e.str());
+}
+
+//----------------------------------------------------------------------------
void cmTarget::CheckProperty(const char* prop, cmMakefile* context)
{
// Certain properties need checking.
@@ -3536,6 +3757,13 @@ void cmTarget::CheckProperty(const char* prop, cmMakefile* context)
cmTargetCheckLINK_INTERFACE_LIBRARIES(prop, value, context, true);
}
}
+ if(strncmp(prop, "INTERFACE_LINK_LIBRARIES", 24) == 0)
+ {
+ if(const char* value = this->GetProperty(prop))
+ {
+ cmTargetCheckINTERFACE_LINK_LIBRARIES(value, context);
+ }
+ }
}
//----------------------------------------------------------------------------
@@ -3830,6 +4058,24 @@ const char *cmTarget::GetProperty(const char* prop,
}
return output.c_str();
}
+ if(strcmp(prop,"COMPILE_DEFINITIONS") == 0)
+ {
+ static std::string output;
+ output = "";
+ std::string sep;
+ typedef cmTargetInternals::TargetPropertyEntry
+ TargetPropertyEntry;
+ for (std::vector<TargetPropertyEntry*>::const_iterator
+ it = this->Internal->CompileDefinitionsEntries.begin(),
+ end = this->Internal->CompileDefinitionsEntries.end();
+ it != end; ++it)
+ {
+ output += sep;
+ output += (*it)->ge->GetInput();
+ sep = ";";
+ }
+ return output.c_str();
+ }
if (strcmp(prop,"IMPORTED") == 0)
{
@@ -5871,11 +6117,16 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config,
// Get the link interface.
{
- std::string linkProp = "IMPORTED_LINK_INTERFACE_LIBRARIES";
- linkProp += suffix;
-
+ std::string linkProp = "INTERFACE_LINK_LIBRARIES";
const char *propertyLibs = this->GetProperty(linkProp.c_str());
+ if (!propertyLibs)
+ {
+ linkProp = "IMPORTED_LINK_INTERFACE_LIBRARIES";
+ linkProp += suffix;
+ propertyLibs = this->GetProperty(linkProp.c_str());
+ }
+
if(!propertyLibs)
{
linkProp = "IMPORTED_LINK_INTERFACE_LIBRARIES";
@@ -5993,6 +6244,48 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface(const char* config,
}
//----------------------------------------------------------------------------
+void cmTarget::GetTransitivePropertyLinkLibraries(
+ const char* config,
+ cmTarget *headTarget,
+ std::vector<std::string> &libs)
+{
+ cmTarget::LinkInterface const* iface = this->GetLinkInterface(config,
+ headTarget);
+ if (!iface)
+ {
+ return;
+ }
+ if(this->GetType() != STATIC_LIBRARY
+ || this->GetPolicyStatusCMP0022() == cmPolicies::WARN
+ || this->GetPolicyStatusCMP0022() == cmPolicies::OLD)
+ {
+ libs = iface->Libraries;
+ return;
+ }
+
+ const char* linkIfaceProp = "INTERFACE_LINK_LIBRARIES";
+ const char* interfaceLibs = this->GetProperty(linkIfaceProp);
+
+ if (!interfaceLibs)
+ {
+ return;
+ }
+
+ // The interface libraries have been explicitly set.
+ cmListFileBacktrace lfbt;
+ cmGeneratorExpression ge(lfbt);
+ cmGeneratorExpressionDAGChecker dagChecker(lfbt, this->GetName(),
+ linkIfaceProp, 0, 0);
+ dagChecker.SetTransitivePropertiesOnly();
+ cmSystemTools::ExpandListArgument(ge.Parse(interfaceLibs)->Evaluate(
+ this->Makefile,
+ config,
+ false,
+ headTarget,
+ this, &dagChecker), libs);
+}
+
+//----------------------------------------------------------------------------
bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface,
cmTarget *headTarget)
{
@@ -6010,6 +6303,8 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface,
// An explicit list of interface libraries may be set for shared
// libraries and executables that export symbols.
const char* explicitLibraries = 0;
+ const char* newExplicitLibraries =
+ this->GetProperty("INTERFACE_LINK_LIBRARIES");
std::string linkIfaceProp;
if(this->GetType() == cmTarget::SHARED_LIBRARY ||
this->IsExecutableWithExports())
@@ -6025,6 +6320,81 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface,
linkIfaceProp = "LINK_INTERFACE_LIBRARIES";
explicitLibraries = this->GetProperty(linkIfaceProp.c_str());
}
+ if (newExplicitLibraries
+ && (!explicitLibraries ||
+ (explicitLibraries
+ && strcmp(newExplicitLibraries, explicitLibraries) != 0)))
+ {
+ switch(this->GetPolicyStatusCMP0022())
+ {
+ case cmPolicies::WARN:
+ {
+ cmOStringStream w;
+ w << (this->Makefile->GetPolicies()
+ ->GetPolicyWarning(cmPolicies::CMP0022)) << "\n"
+ << "Target \"" << this->GetName() << "\" has a "
+ "INTERFACE_LINK_LIBRARIES property which differs from its "
+ << linkIfaceProp << " properties.";
+ this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str());
+ }
+ // Fall through
+ case cmPolicies::OLD:
+ break;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::NEW:
+ explicitLibraries = newExplicitLibraries;
+ linkIfaceProp = "INTERFACE_LINK_LIBRARIES";
+ break;
+ }
+ }
+ }
+ else if(this->GetType() == cmTarget::STATIC_LIBRARY)
+ {
+ if (newExplicitLibraries)
+ {
+ cmListFileBacktrace lfbt;
+ cmGeneratorExpression ge(lfbt);
+ cmGeneratorExpressionDAGChecker dagChecker(lfbt, this->GetName(),
+ "INTERFACE_LINK_LIBRARIES", 0, 0);
+ std::vector<std::string> ifaceLibs;
+ cmSystemTools::ExpandListArgument(
+ ge.Parse(newExplicitLibraries)->Evaluate(
+ this->Makefile,
+ config,
+ false,
+ headTarget,
+ this, &dagChecker), ifaceLibs);
+ LinkImplementation const* impl = this->GetLinkImplementation(config,
+ headTarget);
+ if (ifaceLibs != impl->Libraries)
+ {
+ switch(this->GetPolicyStatusCMP0022())
+ {
+ case cmPolicies::WARN:
+ {
+ cmOStringStream w;
+ w << (this->Makefile->GetPolicies()
+ ->GetPolicyWarning(cmPolicies::CMP0022)) << "\n"
+ << "Static library target \"" << this->GetName() << "\" has a "
+ "INTERFACE_LINK_LIBRARIES property. This should be preferred "
+ "as the source of the link interface for this library. "
+ "Ignoring the property and using the link implementation "
+ "as the link interface instead.";
+ this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str());
+ }
+ // Fall through
+ case cmPolicies::OLD:
+ break;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::NEW:
+ explicitLibraries = newExplicitLibraries;
+ linkIfaceProp = "INTERFACE_LINK_LIBRARIES";
+ break;
+ }
+ }
+ }
}
// There is no implicit link interface for executables or modules
@@ -6088,7 +6458,11 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface,
}
}
}
- else
+ else if (this->GetPolicyStatusCMP0022() == cmPolicies::WARN
+ || this->GetPolicyStatusCMP0022() == cmPolicies::OLD)
+ // The implementation shouldn't be the interface if CMP0022 is NEW. That
+ // way, the LINK_LIBRARIES property can be set directly without having to
+ // empty the INTERFACE_LINK_LIBRARIES
{
// The link implementation is the default link interface.
LinkImplementation const* impl = this->GetLinkImplementation(config,
@@ -6555,6 +6929,7 @@ cmTargetInternalPointer::~cmTargetInternalPointer()
{
deleteAndClear(this->Pointer->IncludeDirectoriesEntries);
deleteAndClear(this->Pointer->CompileOptionsEntries);
+ deleteAndClear(this->Pointer->CompileDefinitionsEntries);
delete this->Pointer;
}
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 62d9fb1..0da0f12 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -19,6 +19,14 @@
#include <cmsys/auto_ptr.hxx>
+#define CM_FOR_EACH_TARGET_POLICY(F) \
+ F(CMP0003) \
+ F(CMP0004) \
+ F(CMP0008) \
+ F(CMP0020) \
+ F(CMP0021) \
+ F(CMP0022)
+
class cmake;
class cmMakefile;
class cmSourceFile;
@@ -91,25 +99,13 @@ public:
void SetMakefile(cmMakefile *mf);
cmMakefile *GetMakefile() const { return this->Makefile;};
- /** Get the status of policy CMP0003 when the target was created. */
- cmPolicies::PolicyStatus GetPolicyStatusCMP0003() const
- { return this->PolicyStatusCMP0003; }
-
- /** Get the status of policy CMP0004 when the target was created. */
- cmPolicies::PolicyStatus GetPolicyStatusCMP0004() const
- { return this->PolicyStatusCMP0004; }
-
- /** Get the status of policy CMP0008 when the target was created. */
- cmPolicies::PolicyStatus GetPolicyStatusCMP0008() const
- { return this->PolicyStatusCMP0008; }
+#define DECLARE_TARGET_POLICY(POLICY) \
+ cmPolicies::PolicyStatus GetPolicyStatus ## POLICY () const \
+ { return this->PolicyStatus ## POLICY; }
- /** Get the status of policy CMP0020 when the target was created. */
- cmPolicies::PolicyStatus GetPolicyStatusCMP0020() const
- { return this->PolicyStatusCMP0020; }
+ CM_FOR_EACH_TARGET_POLICY(DECLARE_TARGET_POLICY)
- /** Get the status of policy CMP0021 when the target was created. */
- cmPolicies::PolicyStatus GetPolicyStatusCMP0021() const
- { return this->PolicyStatusCMP0021; }
+#undef DECLARE_TARGET_POLICY
/**
* Get the list of the custom commands for this target
@@ -276,6 +272,9 @@ public:
if the target cannot be linked. */
LinkInterface const* GetLinkInterface(const char* config,
cmTarget *headTarget);
+ void GetTransitivePropertyLinkLibraries(const char* config,
+ cmTarget *headTarget,
+ std::vector<std::string> &libs);
/** The link implementation specifies the direct library
dependencies needed by the object files of the target. */
@@ -442,7 +441,8 @@ public:
If no macro should be defined null is returned. */
const char* GetExportMacro();
- std::string GetCompileDefinitions(const char *config);
+ void GetCompileDefinitions(std::vector<std::string> &result,
+ const char *config);
// Compute the set of languages compiled by the target. This is
// computed every time it is called because the languages can change
@@ -513,6 +513,8 @@ public:
bool before = false);
void InsertCompileOption(const cmValueWithOrigin &entry,
bool before = false);
+ void InsertCompileDefinition(const cmValueWithOrigin &entry,
+ bool before = false);
void AppendBuildInterfaceIncludes();
@@ -533,7 +535,19 @@ public:
std::string GetDebugGeneratorExpressions(const std::string &value,
cmTarget::LinkLibraryType llt);
+
+ void AddSystemIncludeDirectories(const std::set<cmStdString> &incs);
+ void AddSystemIncludeDirectories(const std::vector<std::string> &incs);
+ std::set<cmStdString> const & GetSystemIncludeDirectories() const
+ { return this->SystemIncludeDirectories; }
+
+ void FinalizeSystemIncludeDirectories();
+
private:
+ // The set of include directories that are marked as system include
+ // directories.
+ std::set<cmStdString> SystemIncludeDirectories;
+
/**
* A list of direct dependencies. Use in conjunction with DependencyMap.
*/
@@ -649,6 +663,7 @@ private:
bool IsImportedTarget;
bool DebugIncludesDone;
bool DebugCompileOptionsDone;
+ bool DebugCompileDefinitionsDone;
mutable std::set<std::string> LinkImplicitNullProperties;
bool BuildInterfaceIncludesAppended;
@@ -687,11 +702,12 @@ private:
cmMakefile* Makefile;
// Policy status recorded when target was created.
- cmPolicies::PolicyStatus PolicyStatusCMP0003;
- cmPolicies::PolicyStatus PolicyStatusCMP0004;
- cmPolicies::PolicyStatus PolicyStatusCMP0008;
- cmPolicies::PolicyStatus PolicyStatusCMP0020;
- cmPolicies::PolicyStatus PolicyStatusCMP0021;
+#define TARGET_POLICY_MEMBER(POLICY) \
+ cmPolicies::PolicyStatus PolicyStatus ## POLICY;
+
+ CM_FOR_EACH_TARGET_POLICY(TARGET_POLICY_MEMBER)
+
+#undef TARGET_POLICY_MEMBER
// Internal representation details.
friend class cmTargetInternals;
diff --git a/Source/cmTargetCompileDefinitionsCommand.cxx b/Source/cmTargetCompileDefinitionsCommand.cxx
index ba0ad59..46c9666 100644
--- a/Source/cmTargetCompileDefinitionsCommand.cxx
+++ b/Source/cmTargetCompileDefinitionsCommand.cxx
@@ -60,7 +60,7 @@ std::string cmTargetCompileDefinitionsCommand
//----------------------------------------------------------------------------
void cmTargetCompileDefinitionsCommand
::HandleDirectContent(cmTarget *tgt, const std::vector<std::string> &content,
- bool)
+ bool, bool)
{
tgt->AppendProperty("COMPILE_DEFINITIONS", this->Join(content).c_str());
}
diff --git a/Source/cmTargetCompileDefinitionsCommand.h b/Source/cmTargetCompileDefinitionsCommand.h
index 22d8fa8..bc58b31 100644
--- a/Source/cmTargetCompileDefinitionsCommand.h
+++ b/Source/cmTargetCompileDefinitionsCommand.h
@@ -82,7 +82,7 @@ private:
virtual void HandleDirectContent(cmTarget *tgt,
const std::vector<std::string> &content,
- bool prepend);
+ bool prepend, bool system);
virtual std::string Join(const std::vector<std::string> &content);
};
diff --git a/Source/cmTargetCompileOptionsCommand.cxx b/Source/cmTargetCompileOptionsCommand.cxx
index e80c845..254acc7 100644
--- a/Source/cmTargetCompileOptionsCommand.cxx
+++ b/Source/cmTargetCompileOptionsCommand.cxx
@@ -53,7 +53,7 @@ std::string cmTargetCompileOptionsCommand
//----------------------------------------------------------------------------
void cmTargetCompileOptionsCommand
::HandleDirectContent(cmTarget *tgt, const std::vector<std::string> &content,
- bool)
+ bool, bool)
{
cmListFileBacktrace lfbt;
this->Makefile->GetBacktrace(lfbt);
diff --git a/Source/cmTargetCompileOptionsCommand.h b/Source/cmTargetCompileOptionsCommand.h
index 87fa1a7..b9afd71 100644
--- a/Source/cmTargetCompileOptionsCommand.h
+++ b/Source/cmTargetCompileOptionsCommand.h
@@ -83,7 +83,7 @@ private:
virtual void HandleDirectContent(cmTarget *tgt,
const std::vector<std::string> &content,
- bool prepend);
+ bool prepend, bool system);
virtual std::string Join(const std::vector<std::string> &content);
};
diff --git a/Source/cmTargetIncludeDirectoriesCommand.cxx b/Source/cmTargetIncludeDirectoriesCommand.cxx
index 12d0a51..e7b906c 100644
--- a/Source/cmTargetIncludeDirectoriesCommand.cxx
+++ b/Source/cmTargetIncludeDirectoriesCommand.cxx
@@ -15,7 +15,8 @@
bool cmTargetIncludeDirectoriesCommand
::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
{
- return this->HandleArguments(args, "INCLUDE_DIRECTORIES", PROCESS_BEFORE);
+ return this->HandleArguments(args, "INCLUDE_DIRECTORIES",
+ ArgumentFlags(PROCESS_BEFORE | PROCESS_SYSTEM));
}
//----------------------------------------------------------------------------
@@ -65,10 +66,39 @@ std::string cmTargetIncludeDirectoriesCommand
//----------------------------------------------------------------------------
void cmTargetIncludeDirectoriesCommand
::HandleDirectContent(cmTarget *tgt, const std::vector<std::string> &content,
- bool prepend)
+ bool prepend, bool system)
{
cmListFileBacktrace lfbt;
this->Makefile->GetBacktrace(lfbt);
cmValueWithOrigin entry(this->Join(content), lfbt);
tgt->InsertInclude(entry, prepend);
+ if (system)
+ {
+ tgt->AddSystemIncludeDirectories(content);
+ }
+}
+
+//----------------------------------------------------------------------------
+void cmTargetIncludeDirectoriesCommand
+::HandleInterfaceContent(cmTarget *tgt,
+ const std::vector<std::string> &content,
+ bool prepend, bool system)
+{
+ cmTargetPropCommandBase::HandleInterfaceContent(tgt, content,
+ prepend, system);
+
+ if (system)
+ {
+ std::string joined;
+ std::string sep;
+ for(std::vector<std::string>::const_iterator it = content.begin();
+ it != content.end(); ++it)
+ {
+ joined += sep;
+ sep = ";";
+ joined += *it;
+ }
+ tgt->AppendProperty("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES",
+ joined.c_str());
+ }
}
diff --git a/Source/cmTargetIncludeDirectoriesCommand.h b/Source/cmTargetIncludeDirectoriesCommand.h
index 4a1a4df..2968618 100644
--- a/Source/cmTargetIncludeDirectoriesCommand.h
+++ b/Source/cmTargetIncludeDirectoriesCommand.h
@@ -54,7 +54,7 @@ public:
virtual const char* GetFullDocumentation() const
{
return
- " target_include_directories(<target> [BEFORE] "
+ " target_include_directories(<target> [SYSTEM] [BEFORE] "
"<INTERFACE|PUBLIC|PRIVATE> [items1...]\n"
" [<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])\n"
"Specify include directories or targets to use when compiling a given "
@@ -71,6 +71,14 @@ public:
"The following arguments specify include directories. Specified "
"include directories may be absolute paths or relative paths. "
"Repeated calls for the same <target> append items in the order called."
+ "If SYSTEM is specified, the compiler will be told the "
+ "directories are meant as system include directories on some "
+ "platforms (signalling this setting might achieve effects such as "
+ "the compiler skipping warnings, or these fixed-install system files "
+ "not being considered in dependency calculations - see compiler "
+ "docs). If SYSTEM is used together with PUBLIC or INTERFACE, the "
+ "INTERFACE_SYSTEM_INCLUDE_DIRECTORIES target property will be "
+ "populated with the specified directories."
"\n"
"Arguments to target_include_directories may use \"generator "
"expressions\" with the syntax \"$<...>\". "
@@ -87,7 +95,11 @@ private:
virtual void HandleDirectContent(cmTarget *tgt,
const std::vector<std::string> &content,
- bool prepend);
+ bool prepend, bool system);
+ virtual void HandleInterfaceContent(cmTarget *tgt,
+ const std::vector<std::string> &content,
+ bool prepend, bool system);
+
virtual std::string Join(const std::vector<std::string> &content);
};
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index b7b7691..c5f490e 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -224,12 +224,17 @@ bool cmTargetLinkLibrariesCommand
cmSystemTools::SetFatalErrorOccured();
}
+ const cmPolicies::PolicyStatus policy22Status
+ = this->Target->GetPolicyStatusCMP0022();
+
// If any of the LINK_ options were given, make sure the
// LINK_INTERFACE_LIBRARIES target property exists.
// Use of any of the new keywords implies awareness of
// this property. And if no libraries are named, it should
// result in an empty link interface.
- if(this->CurrentProcessingState != ProcessingLinkLibraries &&
+ if((policy22Status == cmPolicies::OLD ||
+ policy22Status == cmPolicies::WARN) &&
+ this->CurrentProcessingState != ProcessingLinkLibraries &&
!this->Target->GetProperty("LINK_INTERFACE_LIBRARIES"))
{
this->Target->SetProperty("LINK_INTERFACE_LIBRARIES", "");
@@ -263,11 +268,30 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const char* lib,
->AddLinkLibraryForTarget(this->Target->GetName(), lib, llt);
if (this->CurrentProcessingState != ProcessingPublicInterface)
{
+ if (this->Target->GetType() == cmTarget::STATIC_LIBRARY)
+ {
+ this->Target->AppendProperty("INTERFACE_LINK_LIBRARIES",
+ ("$<LINK_ONLY:" +
+ this->Target->GetDebugGeneratorExpressions(lib, llt) +
+ ">").c_str());
+ }
// Not LINK_INTERFACE_LIBRARIES or LINK_PUBLIC, do not add to interface.
return;
}
}
+ this->Target->AppendProperty("INTERFACE_LINK_LIBRARIES",
+ this->Target->GetDebugGeneratorExpressions(lib, llt).c_str());
+
+ const cmPolicies::PolicyStatus policy22Status
+ = this->Target->GetPolicyStatusCMP0022();
+
+ if (policy22Status != cmPolicies::OLD
+ && policy22Status != cmPolicies::WARN)
+ {
+ return;
+ }
+
// Get the list of configurations considered to be DEBUG.
std::vector<std::string> const& debugConfigs =
this->Makefile->GetCMakeInstance()->GetDebugConfigs();
diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h
index c683016..ca651d0 100644
--- a/Source/cmTargetLinkLibrariesCommand.h
+++ b/Source/cmTargetLinkLibrariesCommand.h
@@ -92,7 +92,7 @@ public:
"When this target is linked into another target then the libraries "
"linked to this target will appear on the link line for the other "
"target too. "
- "See the LINK_INTERFACE_LIBRARIES target property to override the "
+ "See the INTERFACE_LINK_LIBRARIES target property to override the "
"set of transitive link dependencies for a target. "
"Calls to other signatures of this command may set the property "
"making any libraries linked exclusively by this signature private."
@@ -112,14 +112,19 @@ public:
" target_link_libraries(<target> LINK_INTERFACE_LIBRARIES\n"
" [[debug|optimized|general] <lib>] ...)\n"
"The LINK_INTERFACE_LIBRARIES mode appends the libraries "
- "to the LINK_INTERFACE_LIBRARIES and its per-configuration equivalent "
- "target properties instead of using them for linking. "
- "Libraries specified as \"debug\" are appended to the "
+ "to the INTERFACE_LINK_LIBRARIES target property instead of using them "
+ "for linking. If policy CMP0022 is not NEW, then this mode also "
+ "appends libraries to the LINK_INTERFACE_LIBRARIES and its "
+ "per-configuration equivalent. "
+ "Libraries specified as \"debug\" are wrapped in a generator "
+ "expression to correspond to debug builds. If policy CMP0022 is not "
+ "NEW, the libraries are also appended to the "
"LINK_INTERFACE_LIBRARIES_DEBUG property (or to the properties "
"corresponding to configurations listed in the DEBUG_CONFIGURATIONS "
"global property if it is set). "
"Libraries specified as \"optimized\" are appended to the "
- "LINK_INTERFACE_LIBRARIES property. "
+ "INTERFACE_LINK_LIBRARIES property. If policy CMP0022 is not NEW, "
+ "they are also appended to the LINK_INTERFACE_LIBRARIES property. "
"Libraries specified as \"general\" (or without any keyword) are "
"treated as if specified for both \"debug\" and \"optimized\"."
"\n"
@@ -131,9 +136,11 @@ public:
"The LINK_PUBLIC and LINK_PRIVATE modes can be used to specify both "
"the link dependencies and the link interface in one command. "
"Libraries and targets following LINK_PUBLIC are linked to, and are "
- "made part of the LINK_INTERFACE_LIBRARIES. Libraries and targets "
- "following LINK_PRIVATE are linked to, but are not made part of the "
- "LINK_INTERFACE_LIBRARIES. "
+ "made part of the INTERFACE_LINK_LIBRARIES. If policy CMP0022 is not "
+ "NEW, they are also made part of the LINK_INTERFACE_LIBRARIES. "
+ "Libraries and targets following LINK_PRIVATE are linked to, but are "
+ "not made part of the INTERFACE_LINK_LIBRARIES (or "
+ "LINK_INTERFACE_LIBRARIES)."
"\n"
"The library dependency graph is normally acyclic (a DAG), but in the "
"case of mutually-dependent STATIC libraries CMake allows the graph "
diff --git a/Source/cmTargetPropCommandBase.cxx b/Source/cmTargetPropCommandBase.cxx
index 771097c..287ce46 100644
--- a/Source/cmTargetPropCommandBase.cxx
+++ b/Source/cmTargetPropCommandBase.cxx
@@ -48,8 +48,20 @@ bool cmTargetPropCommandBase
return false;
}
+ bool system = false;
unsigned int argIndex = 1;
+ if ((flags & PROCESS_SYSTEM) && args[argIndex] == "SYSTEM")
+ {
+ if (args.size() < 4)
+ {
+ this->SetError("called with incorrect number of arguments");
+ return false;
+ }
+ system = true;
+ ++argIndex;
+ }
+
bool prepend = false;
if ((flags & PROCESS_BEFORE) && args[argIndex] == "BEFORE")
{
@@ -66,7 +78,7 @@ bool cmTargetPropCommandBase
while (argIndex < args.size())
{
- if (!this->ProcessContentArgs(args, argIndex, prepend))
+ if (!this->ProcessContentArgs(args, argIndex, prepend, system))
{
return false;
}
@@ -77,7 +89,7 @@ bool cmTargetPropCommandBase
//----------------------------------------------------------------------------
bool cmTargetPropCommandBase
::ProcessContentArgs(std::vector<std::string> const& args,
- unsigned int &argIndex, bool prepend)
+ unsigned int &argIndex, bool prepend, bool system)
{
const std::string scope = args[argIndex];
@@ -105,12 +117,12 @@ bool cmTargetPropCommandBase
|| args[i] == "PRIVATE"
|| args[i] == "INTERFACE" )
{
- this->PopulateTargetProperies(scope, content, prepend);
+ this->PopulateTargetProperies(scope, content, prepend, system);
return true;
}
content.push_back(args[i]);
}
- this->PopulateTargetProperies(scope, content, prepend);
+ this->PopulateTargetProperies(scope, content, prepend, system);
return true;
}
@@ -118,27 +130,35 @@ bool cmTargetPropCommandBase
void cmTargetPropCommandBase
::PopulateTargetProperies(const std::string &scope,
const std::vector<std::string> &content,
- bool prepend)
+ bool prepend, bool system)
{
if (scope == "PRIVATE" || scope == "PUBLIC")
{
- this->HandleDirectContent(this->Target, content, prepend);
+ this->HandleDirectContent(this->Target, content, prepend, system);
}
if (scope == "INTERFACE" || scope == "PUBLIC")
{
- if (prepend)
- {
- const std::string propName = std::string("INTERFACE_") + this->Property;
- const char *propValue = this->Target->GetProperty(propName.c_str());
- const std::string totalContent = this->Join(content) + (propValue
- ? std::string(";") + propValue
- : std::string());
- this->Target->SetProperty(propName.c_str(), totalContent.c_str());
- }
- else
- {
- this->Target->AppendProperty(("INTERFACE_" + this->Property).c_str(),
- this->Join(content).c_str());
- }
+ this->HandleInterfaceContent(this->Target, content, prepend, system);
+ }
+}
+
+//----------------------------------------------------------------------------
+void cmTargetPropCommandBase::HandleInterfaceContent(cmTarget *tgt,
+ const std::vector<std::string> &content,
+ bool prepend, bool)
+{
+ if (prepend)
+ {
+ const std::string propName = std::string("INTERFACE_") + this->Property;
+ const char *propValue = tgt->GetProperty(propName.c_str());
+ const std::string totalContent = this->Join(content) + (propValue
+ ? std::string(";") + propValue
+ : std::string());
+ tgt->SetProperty(propName.c_str(), totalContent.c_str());
+ }
+ else
+ {
+ tgt->AppendProperty(("INTERFACE_" + this->Property).c_str(),
+ this->Join(content).c_str());
}
}
diff --git a/Source/cmTargetPropCommandBase.h b/Source/cmTargetPropCommandBase.h
index 8047a48..690582f 100644
--- a/Source/cmTargetPropCommandBase.h
+++ b/Source/cmTargetPropCommandBase.h
@@ -25,7 +25,8 @@ public:
enum ArgumentFlags {
NO_FLAGS = 0,
- PROCESS_BEFORE = 1
+ PROCESS_BEFORE = 1,
+ PROCESS_SYSTEM = 2
};
bool HandleArguments(std::vector<std::string> const& args,
@@ -36,20 +37,24 @@ protected:
std::string Property;
cmTarget *Target;
+ virtual void HandleInterfaceContent(cmTarget *tgt,
+ const std::vector<std::string> &content,
+ bool prepend, bool system);
private:
virtual void HandleImportedTarget(const std::string &tgt) = 0;
virtual void HandleMissingTarget(const std::string &name) = 0;
virtual void HandleDirectContent(cmTarget *tgt,
const std::vector<std::string> &content,
- bool prepend) = 0;
+ bool prepend, bool system) = 0;
+
virtual std::string Join(const std::vector<std::string> &content) = 0;
bool ProcessContentArgs(std::vector<std::string> const& args,
- unsigned int &argIndex, bool prepend);
+ unsigned int &argIndex, bool prepend, bool system);
void PopulateTargetProperies(const std::string &scope,
const std::vector<std::string> &content,
- bool prepend);
+ bool prepend, bool system);
};
#endif
diff --git a/Source/cmTryCompileCommand.h b/Source/cmTryCompileCommand.h
index 163756d..a20594c 100644
--- a/Source/cmTryCompileCommand.h
+++ b/Source/cmTryCompileCommand.h
@@ -69,14 +69,14 @@ public:
" [COMPILE_DEFINITIONS flags...]\n"
" [LINK_LIBRARIES libs...]\n"
" [OUTPUT_VARIABLE <var>]\n"
- " [COPY_FILE <fileName>])\n"
+ " [COPY_FILE <fileName> [COPY_FILE_ERROR <var>]])\n"
"Try building an executable from one or more source files. "
"In this form the user need only supply one or more source files "
"that include a definition for 'main'. "
"CMake will create a CMakeLists.txt file to build the source(s) "
"as an executable. "
"Specify COPY_FILE to get a copy of the linked executable at the "
- "given fileName."
+ "given fileName and optionally COPY_FILE_ERROR to capture any error."
"\n"
"In this version all files in bindir/CMakeFiles/CMakeTmp "
"will be cleaned automatically. For debugging, --debug-trycompile can "
diff --git a/Source/cmVS10LinkFlagTable.h b/Source/cmVS10LinkFlagTable.h
index 64febbb..5d15620 100644
--- a/Source/cmVS10LinkFlagTable.h
+++ b/Source/cmVS10LinkFlagTable.h
@@ -201,7 +201,7 @@ static cmVS7FlagTable cmVS10LinkFlagTable[] =
cmVS7FlagTable::UserValueRequired},
{"GenerateMapFile", "MAP", "", "true",
cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
- {"MapFileName", "MAP", "Generate Map File", "",
+ {"MapFileName", "MAP:", "Generate Map File", "",
cmVS7FlagTable::UserValueRequired},
//String List Properties
diff --git a/Source/cmVS11LinkFlagTable.h b/Source/cmVS11LinkFlagTable.h
index ea0d0f0..b4587a8 100644
--- a/Source/cmVS11LinkFlagTable.h
+++ b/Source/cmVS11LinkFlagTable.h
@@ -227,7 +227,7 @@ static cmVS7FlagTable cmVS11LinkFlagTable[] =
cmVS7FlagTable::UserValueRequired},
{"GenerateMapFile", "MAP", "", "true",
cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
- {"MapFileName", "MAP", "Generate Map File", "",
+ {"MapFileName", "MAP:", "Generate Map File", "",
cmVS7FlagTable::UserValueRequired},
//String List Properties
diff --git a/Source/cmVS12LinkFlagTable.h b/Source/cmVS12LinkFlagTable.h
index ce32e38..73d450a 100644
--- a/Source/cmVS12LinkFlagTable.h
+++ b/Source/cmVS12LinkFlagTable.h
@@ -227,7 +227,7 @@ static cmVS7FlagTable cmVS12LinkFlagTable[] =
cmVS7FlagTable::UserValueRequired},
{"GenerateMapFile", "MAP", "", "true",
cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
- {"MapFileName", "MAP", "Generate Map File", "",
+ {"MapFileName", "MAP:", "Generate Map File", "",
cmVS7FlagTable::UserValueRequired},
//String List Properties
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 50f195e..d59de11 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1337,8 +1337,9 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
clOptions.AddFlag("AssemblerListingLocation", asmLocation.c_str());
clOptions.Parse(flags.c_str());
clOptions.Parse(defineFlags.c_str());
- clOptions.AddDefines(this->Target->GetCompileDefinitions(
- configName.c_str()).c_str());
+ std::vector<std::string> targetDefines;
+ this->Target->GetCompileDefinitions(targetDefines, configName.c_str());
+ clOptions.AddDefines(targetDefines);
clOptions.SetVerboseMakefile(
this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE"));
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index fcec068..290aff0 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -612,7 +612,7 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
std::vector<std::string> includeDirs;
cmSystemTools::ExpandListArgument(includes, includeDirs);
- std::string includeFlags = lg->GetIncludeFlags(includeDirs,
+ std::string includeFlags = lg->GetIncludeFlags(includeDirs, 0,
language.c_str(), false);
std::string definitions = mf->GetSafeDefinition("PACKAGE_DEFINITIONS");
@@ -3667,11 +3667,11 @@ void cmake::RecordPropertyAccess(const char *name,
void cmake::ReportUndefinedPropertyAccesses(const char *filename)
{
+ if(!this->GlobalGenerator)
+ { return; }
FILE *progFile = fopen(filename,"w");
- if (!progFile || !this->GlobalGenerator)
- {
- return;
- }
+ if(!progFile)
+ { return; }
// what are the enabled languages?
std::vector<std::string> enLangs;
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 4d5af5e..935b836 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -4261,17 +4261,13 @@ bool SystemTools::IsSubDirectory(const char* cSubdir, const char* cDir)
}
kwsys_stl::string subdir = cSubdir;
kwsys_stl::string dir = cDir;
+ SystemTools::ConvertToUnixSlashes(subdir);
SystemTools::ConvertToUnixSlashes(dir);
- kwsys_stl::string path = subdir;
- do
+ if(subdir.size() > dir.size() && subdir[dir.size()] == '/')
{
- path = SystemTools::GetParentDirectory(path.c_str());
- if(SystemTools::ComparePath(dir.c_str(), path.c_str()))
- {
- return true;
- }
+ std::string s = subdir.substr(0, dir.size());
+ return SystemTools::ComparePath(s.c_str(), dir.c_str());
}
- while ( path.size() > dir.size() );
return false;
}
diff --git a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt
index b003a1b..2240539 100644
--- a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt
+++ b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt
@@ -122,3 +122,5 @@ add_library(libConsumer empty.cpp)
# evaluates to the empty string in non-Debug cases, ensure that that causes
# no problems.
target_link_libraries(libConsumer debug depA)
+
+add_subdirectory(cmp0022)
diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt
new file mode 100644
index 0000000..dd6ab41
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt
@@ -0,0 +1,18 @@
+
+include(GenerateExportHeader)
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+cmake_policy(SET CMP0022 NEW)
+add_library(cmp0022lib SHARED cmp0022lib.cpp)
+generate_export_header(cmp0022lib)
+add_library(cmp0022ifacelib SHARED cmp0022ifacelib.cpp)
+generate_export_header(cmp0022ifacelib)
+target_link_libraries(cmp0022lib LINK_PUBLIC cmp0022ifacelib)
+
+assert_property(cmp0022lib LINK_INTERFACE_LIBRARIES "")
+assert_property(cmp0022ifacelib LINK_INTERFACE_LIBRARIES "")
+assert_property(cmp0022lib INTERFACE_LINK_LIBRARIES "cmp0022ifacelib")
+assert_property(cmp0022ifacelib INTERFACE_LINK_LIBRARIES "")
+
+add_executable(cmp0022exe cmp0022exe.cpp)
+target_link_libraries(cmp0022exe cmp0022lib)
diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/cmp0022exe.cpp b/Tests/CMakeCommands/target_link_libraries/cmp0022/cmp0022exe.cpp
new file mode 100644
index 0000000..008bb74
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/cmp0022exe.cpp
@@ -0,0 +1,7 @@
+
+#include "cmp0022lib.h"
+
+int main(void)
+{
+ return cmp0022().Value;
+}
diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/cmp0022ifacelib.cpp b/Tests/CMakeCommands/target_link_libraries/cmp0022/cmp0022ifacelib.cpp
new file mode 100644
index 0000000..b285be0
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/cmp0022ifacelib.cpp
@@ -0,0 +1,9 @@
+
+#include "cmp0022ifacelib.h"
+
+CMP0022Iface cmp0022iface()
+{
+ CMP0022Iface iface;
+ iface.Value = 0;
+ return iface;
+}
diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/cmp0022ifacelib.h b/Tests/CMakeCommands/target_link_libraries/cmp0022/cmp0022ifacelib.h
new file mode 100644
index 0000000..616dbf6
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/cmp0022ifacelib.h
@@ -0,0 +1,9 @@
+
+#include "cmp0022ifacelib_export.h"
+
+struct CMP0022Iface
+{
+ int Value;
+};
+
+CMP0022Iface CMP0022IFACELIB_EXPORT cmp0022iface();
diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/cmp0022lib.cpp b/Tests/CMakeCommands/target_link_libraries/cmp0022/cmp0022lib.cpp
new file mode 100644
index 0000000..381d463
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/cmp0022lib.cpp
@@ -0,0 +1,7 @@
+
+#include "cmp0022lib.h"
+
+CMP0022Iface cmp0022()
+{
+ return cmp0022iface();
+}
diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/cmp0022lib.h b/Tests/CMakeCommands/target_link_libraries/cmp0022/cmp0022lib.h
new file mode 100644
index 0000000..3235b9b
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/cmp0022lib.h
@@ -0,0 +1,6 @@
+
+#include "cmp0022lib_export.h"
+
+#include "cmp0022ifacelib.h"
+
+CMP0022Iface CMP0022LIB_EXPORT cmp0022();
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 36cd7fd..fcefaf9 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -2528,6 +2528,16 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--test-command IncludeDirectories)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/IncludeDirectories")
+ add_test(InterfaceLinkLibraries ${CMAKE_CTEST_COMMAND}
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/InterfaceLinkLibraries"
+ "${CMake_BINARY_DIR}/Tests/InterfaceLinkLibraries"
+ --build-two-config
+ ${build_generator_args}
+ --build-project InterfaceLinkLibraries
+ --test-command InterfaceLinkLibraries)
+ list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/InterfaceLinkLibraries")
+
if(CMAKE_USE_KWSTYLE AND KWSTYLE_EXECUTABLE)
# The "make StyleCheck" command line as a test. If the test fails, look
# for lines like "Error #0 (624) Line length exceed 88 (max=79)" in the
diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt
index efecd03..370dffe 100644
--- a/Tests/ExportImport/Export/CMakeLists.txt
+++ b/Tests/ExportImport/Export/CMakeLists.txt
@@ -184,6 +184,9 @@ set_property(TARGET testSharedLibRequired APPEND PROPERTY
INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include/testSharedLibRequired>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}>"
)
+set_property(TARGET testSharedLibRequired APPEND PROPERTY
+ INTERFACE_COMPILE_DEFINITIONS USING_TESTSHAREDLIBREQUIRED
+)
set_property(TARGET testSharedLibRequired
APPEND PROPERTY
COMPATIBLE_INTERFACE_BOOL CUSTOM_PROP
@@ -232,6 +235,33 @@ target_link_libraries(testSharedLibDepends LINK_PUBLIC renamed_on_export)
target_link_libraries(testSharedLibDepends LINK_INTERFACE_LIBRARIES
$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:$<TARGET_NAME:testSharedLibRequired>>)
+add_library(cmp0022OLD SHARED cmp0022_vs6_1.cpp)
+generate_export_header(cmp0022OLD BASE_NAME cmp0022)
+target_include_directories(cmp0022OLD PUBLIC
+ "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}>"
+ "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include/cmp0022>"
+)
+cmake_policy(SET CMP0022 NEW)
+add_library(cmp0022NEW SHARED cmp0022_vs6_1.cpp)
+target_include_directories(cmp0022NEW PUBLIC
+ "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}>"
+ "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include/cmp0022>"
+)
+cmake_policy(SET CMP0022 OLD)
+install(FILES
+ "${CMAKE_CURRENT_SOURCE_DIR}/cmp0022.h"
+ "${CMAKE_CURRENT_BINARY_DIR}/cmp0022_export.h"
+ DESTINATION include/cmp0022
+)
+
+set_property(TARGET testLib2 APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS USING_TESTLIB2)
+set_property(TARGET testLib3 APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS USING_TESTLIB3)
+
+set_property(TARGET cmp0022NEW APPEND PROPERTY INTERFACE_LINK_LIBRARIES testLib2)
+# set_property(TARGET cmp0022NEW APPEND PROPERTY LINK_INTERFACE_LIBRARIES testLibIncludeRequired2) # TODO: Test for error
+set_property(TARGET cmp0022OLD APPEND PROPERTY INTERFACE_LINK_LIBRARIES testLib2)
+set_property(TARGET cmp0022OLD APPEND PROPERTY LINK_INTERFACE_LIBRARIES testLib3)
+
install(TARGETS testLibRequired
testLibIncludeRequired1
testLibIncludeRequired2
@@ -273,6 +303,7 @@ install(
testExe2lib testLib4lib testLib4libdbg testLib4libopt
testLib6
testLibCycleA testLibCycleB
+ cmp0022NEW cmp0022OLD
EXPORT exp
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib NAMELINK_SKIP
@@ -316,6 +347,7 @@ add_subdirectory(sublib) # For CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE test.
export(TARGETS testExe1 testLib1 testLib2 testLib3
testExe2libImp testLib3Imp testLib3ImpDep subdirlib
testSharedLibRequired testSharedLibDepends renamed_on_export
+ cmp0022NEW cmp0022OLD
NAMESPACE bld_
FILE ExportBuildTree.cmake
)
diff --git a/Tests/ExportImport/Export/cmp0022.cpp b/Tests/ExportImport/Export/cmp0022.cpp
new file mode 100644
index 0000000..bef8e61
--- /dev/null
+++ b/Tests/ExportImport/Export/cmp0022.cpp
@@ -0,0 +1,7 @@
+
+#include "cmp0022.h"
+
+int cmp0022()
+{
+ return 0;
+}
diff --git a/Tests/ExportImport/Export/cmp0022.h b/Tests/ExportImport/Export/cmp0022.h
new file mode 100644
index 0000000..32bf71a
--- /dev/null
+++ b/Tests/ExportImport/Export/cmp0022.h
@@ -0,0 +1,4 @@
+
+#include "cmp0022_export.h"
+
+int CMP0022_EXPORT cmp0022();
diff --git a/Tests/ExportImport/Export/cmp0022_vs6_1.cpp b/Tests/ExportImport/Export/cmp0022_vs6_1.cpp
new file mode 100644
index 0000000..a6ec838
--- /dev/null
+++ b/Tests/ExportImport/Export/cmp0022_vs6_1.cpp
@@ -0,0 +1 @@
+#include "cmp0022.cpp"
diff --git a/Tests/ExportImport/Export/cmp0022_vs6_2.cpp b/Tests/ExportImport/Export/cmp0022_vs6_2.cpp
new file mode 100644
index 0000000..a6ec838
--- /dev/null
+++ b/Tests/ExportImport/Export/cmp0022_vs6_2.cpp
@@ -0,0 +1 @@
+#include "cmp0022.cpp"
diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt
index 3bfbc46..aa8847b 100644
--- a/Tests/ExportImport/Import/A/CMakeLists.txt
+++ b/Tests/ExportImport/Import/A/CMakeLists.txt
@@ -68,6 +68,16 @@ target_link_libraries(imp_testExe1b
bld_testLibCycleA
)
+add_executable(cmp0022OLD_test cmp0022OLD_test_vs6_1.cpp)
+target_link_libraries(cmp0022OLD_test bld_cmp0022OLD)
+add_executable(cmp0022NEW_test cmp0022NEW_test_vs6_1.cpp)
+target_link_libraries(cmp0022NEW_test bld_cmp0022NEW)
+
+add_executable(cmp0022OLD_exp_test cmp0022OLD_test_vs6_2.cpp)
+target_link_libraries(cmp0022OLD_exp_test exp_cmp0022OLD)
+add_executable(cmp0022NEW_exp_test cmp0022NEW_test_vs6_2.cpp)
+target_link_libraries(cmp0022NEW_exp_test exp_cmp0022NEW)
+
# Try building a plugin to an executable imported from the build tree.
add_library(imp_mod1b MODULE imp_mod1.c)
target_link_libraries(imp_mod1b bld_testExe2)
@@ -218,3 +228,36 @@ target_compile_definitions(deps_shared_iface2
$<$<BOOL:$<TARGET_PROPERTY:CUSTOM_PROP>>:CUSTOM_PROPERTY_IS_ON>
$<$<STREQUAL:$<TARGET_PROPERTY:CUSTOM_STRING>,testcontent>:CUSTOM_STRING_IS_MATCH>
)
+
+add_subdirectory(excludedFromAll)
+
+add_executable(iface_test_bld iface_test.cpp)
+target_link_libraries(iface_test_bld bld_testSharedLibDepends)
+
+set_property(TARGET bld_testSharedLibRequired APPEND PROPERTY
+ LINK_INTERFACE_LIBRARIES
+ excludedFromAll
+)
+get_target_property(_configs bld_testSharedLibRequired IMPORTED_CONFIGURATIONS)
+foreach(_config ${_configs})
+ set_property(TARGET bld_testSharedLibRequired APPEND PROPERTY
+ IMPORTED_LINK_INTERFACE_LIBRARIES_${_config}
+ excludedFromAll
+ )
+endforeach()
+unset(_configs)
+add_executable(iface_test_exp iface_test.cpp)
+target_link_libraries(iface_test_exp testSharedLibDepends)
+
+set_property(TARGET testSharedLibDepends APPEND PROPERTY
+ LINK_INTERFACE_LIBRARIES
+ excludedFromAll
+)
+get_target_property(_configs testSharedLibDepends IMPORTED_CONFIGURATIONS)
+foreach(_config ${_configs})
+ set_property(TARGET testSharedLibDepends APPEND PROPERTY
+ IMPORTED_LINK_INTERFACE_LIBRARIES_${_config}
+ excludedFromAll
+ )
+endforeach()
+unset(_configs)
diff --git a/Tests/ExportImport/Import/A/cmp0022NEW_test.cpp b/Tests/ExportImport/Import/A/cmp0022NEW_test.cpp
new file mode 100644
index 0000000..5878349
--- /dev/null
+++ b/Tests/ExportImport/Import/A/cmp0022NEW_test.cpp
@@ -0,0 +1,12 @@
+
+#ifndef USING_TESTLIB2
+#error Expected USING_TESTLIB2
+#endif
+#ifdef USING_TESTLIB3
+#error Unexpected USING_TESTLIB3
+#endif
+
+int main(void)
+{
+ return 0;
+}
diff --git a/Tests/ExportImport/Import/A/cmp0022NEW_test_vs6_1.cpp b/Tests/ExportImport/Import/A/cmp0022NEW_test_vs6_1.cpp
new file mode 100644
index 0000000..033b746
--- /dev/null
+++ b/Tests/ExportImport/Import/A/cmp0022NEW_test_vs6_1.cpp
@@ -0,0 +1 @@
+#include "cmp0022NEW_test.cpp"
diff --git a/Tests/ExportImport/Import/A/cmp0022NEW_test_vs6_2.cpp b/Tests/ExportImport/Import/A/cmp0022NEW_test_vs6_2.cpp
new file mode 100644
index 0000000..033b746
--- /dev/null
+++ b/Tests/ExportImport/Import/A/cmp0022NEW_test_vs6_2.cpp
@@ -0,0 +1 @@
+#include "cmp0022NEW_test.cpp"
diff --git a/Tests/ExportImport/Import/A/cmp0022OLD_test.cpp b/Tests/ExportImport/Import/A/cmp0022OLD_test.cpp
new file mode 100644
index 0000000..e50158b
--- /dev/null
+++ b/Tests/ExportImport/Import/A/cmp0022OLD_test.cpp
@@ -0,0 +1,12 @@
+
+#ifdef USING_TESTLIB2
+#error Unexpected USING_TESTLIB2
+#endif
+#ifndef USING_TESTLIB3
+#error Expected USING_TESTLIB3
+#endif
+
+int main(void)
+{
+ return 0;
+}
diff --git a/Tests/ExportImport/Import/A/cmp0022OLD_test_vs6_1.cpp b/Tests/ExportImport/Import/A/cmp0022OLD_test_vs6_1.cpp
new file mode 100644
index 0000000..90d804c
--- /dev/null
+++ b/Tests/ExportImport/Import/A/cmp0022OLD_test_vs6_1.cpp
@@ -0,0 +1 @@
+#include "cmp0022OLD_test.cpp"
diff --git a/Tests/ExportImport/Import/A/cmp0022OLD_test_vs6_2.cpp b/Tests/ExportImport/Import/A/cmp0022OLD_test_vs6_2.cpp
new file mode 100644
index 0000000..90d804c
--- /dev/null
+++ b/Tests/ExportImport/Import/A/cmp0022OLD_test_vs6_2.cpp
@@ -0,0 +1 @@
+#include "cmp0022OLD_test.cpp"
diff --git a/Tests/ExportImport/Import/A/excludedFromAll/CMakeLists.txt b/Tests/ExportImport/Import/A/excludedFromAll/CMakeLists.txt
new file mode 100644
index 0000000..cd5a59b
--- /dev/null
+++ b/Tests/ExportImport/Import/A/excludedFromAll/CMakeLists.txt
@@ -0,0 +1,7 @@
+
+set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+include(GenerateExportHeader)
+add_library(excludedFromAll SHARED EXCLUDE_FROM_ALL excludedFromAll.cpp)
+generate_export_header(excludedFromAll)
diff --git a/Tests/ExportImport/Import/A/excludedFromAll/excludedFromAll.cpp b/Tests/ExportImport/Import/A/excludedFromAll/excludedFromAll.cpp
new file mode 100644
index 0000000..2269a04
--- /dev/null
+++ b/Tests/ExportImport/Import/A/excludedFromAll/excludedFromAll.cpp
@@ -0,0 +1,7 @@
+
+#include "excludedFromAll.h"
+
+int excludedFromAll()
+{
+ return 0;
+}
diff --git a/Tests/ExportImport/Import/A/excludedFromAll/excludedFromAll.h b/Tests/ExportImport/Import/A/excludedFromAll/excludedFromAll.h
new file mode 100644
index 0000000..4820c76
--- /dev/null
+++ b/Tests/ExportImport/Import/A/excludedFromAll/excludedFromAll.h
@@ -0,0 +1,4 @@
+
+#include "excludedfromall_export.h"
+
+int EXCLUDEDFROMALL_EXPORT excludedFromAll();
diff --git a/Tests/ExportImport/Import/A/iface_test.cpp b/Tests/ExportImport/Import/A/iface_test.cpp
new file mode 100644
index 0000000..fa4474b
--- /dev/null
+++ b/Tests/ExportImport/Import/A/iface_test.cpp
@@ -0,0 +1,11 @@
+
+#ifndef USING_TESTSHAREDLIBREQUIRED
+#error Expected USING_TESTSHAREDLIBREQUIRED
+#endif
+
+#include "excludedFromAll.h"
+
+int main(void)
+{
+ return excludedFromAll();
+}
diff --git a/Tests/IncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/CMakeLists.txt
index 3e3ecc9..596a280 100644
--- a/Tests/IncludeDirectories/CMakeLists.txt
+++ b/Tests/IncludeDirectories/CMakeLists.txt
@@ -1,6 +1,23 @@
cmake_minimum_required (VERSION 2.6)
project(IncludeDirectories)
+if (((CMAKE_C_COMPILER_ID STREQUAL GNU AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.4)
+ OR CMAKE_C_COMPILER_ID STREQUAL Clang)
+ AND (CMAKE_GENERATOR STREQUAL "Unix Makefiles" OR CMAKE_GENERATOR STREQUAL "Ninja"))
+ include(CheckCXXCompilerFlag)
+ check_cxx_compiler_flag(-Wunused-variable run_sys_includes_test)
+ if(run_sys_includes_test)
+ # The Bullseye wrapper appears to break the -isystem effect.
+ execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version OUTPUT_VARIABLE out ERROR_VARIABLE out)
+ if("x${out}" MATCHES "Bullseye")
+ set(run_sys_includes_test 0)
+ endif()
+ endif()
+ if (run_sys_includes_test)
+ add_subdirectory(SystemIncludeDirectories)
+ endif()
+endif()
+
file(WRITE ${CMAKE_BINARY_DIR}/Flags/Flags.h
"//Flags.h
")
diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt
new file mode 100644
index 0000000..aec6ff9
--- /dev/null
+++ b/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt
@@ -0,0 +1,19 @@
+
+cmake_minimum_required(VERSION 2.8)
+
+project(SystemIncludeDirectories)
+
+add_library(systemlib systemlib.cpp)
+target_include_directories(systemlib PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/systemlib")
+
+add_library(upstream upstream.cpp)
+target_link_libraries(upstream LINK_PUBLIC systemlib)
+target_compile_options(upstream PRIVATE -Werror=unused-variable)
+
+target_include_directories(upstream SYSTEM PUBLIC
+ $<TARGET_PROPERTY:systemlib,INTERFACE_INCLUDE_DIRECTORIES>
+)
+
+add_library(consumer consumer.cpp)
+target_link_libraries(consumer upstream)
+target_compile_options(consumer PRIVATE -Werror=unused-variable)
diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/consumer.cpp b/Tests/IncludeDirectories/SystemIncludeDirectories/consumer.cpp
new file mode 100644
index 0000000..197dae8
--- /dev/null
+++ b/Tests/IncludeDirectories/SystemIncludeDirectories/consumer.cpp
@@ -0,0 +1,7 @@
+
+#include "upstream.h"
+
+int consumer()
+{
+ return upstream();
+}
diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/systemlib.cpp b/Tests/IncludeDirectories/SystemIncludeDirectories/systemlib.cpp
new file mode 100644
index 0000000..f111bfa
--- /dev/null
+++ b/Tests/IncludeDirectories/SystemIncludeDirectories/systemlib.cpp
@@ -0,0 +1,4 @@
+
+#include "systemlib.h"
+
+int systemlib() { return 0; }
diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/systemlib/systemlib.h b/Tests/IncludeDirectories/SystemIncludeDirectories/systemlib/systemlib.h
new file mode 100644
index 0000000..c84de6a
--- /dev/null
+++ b/Tests/IncludeDirectories/SystemIncludeDirectories/systemlib/systemlib.h
@@ -0,0 +1,19 @@
+
+#ifndef SYSTEMLIB_H
+#define SYSTEMLIB_H
+
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+int systemlib();
+
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+int unusedFunc()
+{
+ int unused;
+ return systemlib();
+}
+
+#endif
diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/upstream.cpp b/Tests/IncludeDirectories/SystemIncludeDirectories/upstream.cpp
new file mode 100644
index 0000000..f716b99
--- /dev/null
+++ b/Tests/IncludeDirectories/SystemIncludeDirectories/upstream.cpp
@@ -0,0 +1,4 @@
+
+#include "upstream.h"
+
+int upstream() { return systemlib(); }
diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/upstream.h b/Tests/IncludeDirectories/SystemIncludeDirectories/upstream.h
new file mode 100644
index 0000000..3628568
--- /dev/null
+++ b/Tests/IncludeDirectories/SystemIncludeDirectories/upstream.h
@@ -0,0 +1,12 @@
+
+#ifndef UPSTREAM_H
+#define UPSTREAM_H
+
+#include "systemlib.h"
+
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+int upstream();
+
+#endif
diff --git a/Tests/InterfaceLinkLibraries/CMakeLists.txt b/Tests/InterfaceLinkLibraries/CMakeLists.txt
new file mode 100644
index 0000000..bd0cf74
--- /dev/null
+++ b/Tests/InterfaceLinkLibraries/CMakeLists.txt
@@ -0,0 +1,49 @@
+cmake_minimum_required (VERSION 2.8)
+
+cmake_policy(SET CMP0022 NEW)
+
+project(InterfaceLinkLibraries)
+
+add_library(foo_shared SHARED foo_vs6_1.cpp)
+target_compile_definitions(foo_shared INTERFACE FOO_LIBRARY)
+add_library(bar_shared SHARED bar_vs6_1.cpp)
+target_compile_definitions(bar_shared INTERFACE BAR_LIBRARY)
+set_property(TARGET bar_shared APPEND PROPERTY INTERFACE_LINK_LIBRARIES foo_shared)
+
+add_executable(shared_test main_vs6_1.cpp)
+set_property(TARGET shared_test APPEND PROPERTY LINK_LIBRARIES bar_shared)
+
+add_library(foo_static STATIC foo_vs6_2.cpp)
+target_compile_definitions(foo_static INTERFACE FOO_LIBRARY)
+add_library(bar_static STATIC bar_vs6_2.cpp)
+target_compile_definitions(bar_static INTERFACE BAR_LIBRARY)
+set_property(TARGET bar_static APPEND PROPERTY INTERFACE_LINK_LIBRARIES foo_static)
+
+add_executable(static_test main_vs6_2.cpp)
+set_property(TARGET static_test APPEND PROPERTY LINK_LIBRARIES bar_static)
+
+add_library(foo_shared_private SHARED foo_vs6_3.cpp)
+target_compile_definitions(foo_shared_private INTERFACE FOO_LIBRARY)
+add_library(bang_shared_private SHARED bang_vs6_1.cpp)
+target_compile_definitions(bang_shared_private INTERFACE BANG_LIBRARY)
+add_library(bar_shared_private SHARED bar_vs6_3.cpp)
+target_compile_definitions(bar_shared_private INTERFACE BAR_LIBRARY)
+target_compile_definitions(bar_shared_private PRIVATE BAR_USE_BANG)
+set_property(TARGET bar_shared_private APPEND PROPERTY LINK_LIBRARIES bang_shared_private)
+set_property(TARGET bar_shared_private APPEND PROPERTY INTERFACE_LINK_LIBRARIES foo_shared_private)
+
+add_executable(shared_private_test main_vs6_3.cpp)
+set_property(TARGET shared_private_test APPEND PROPERTY LINK_LIBRARIES bar_shared_private)
+
+add_library(foo_static_private STATIC foo_vs6_4.cpp)
+target_compile_definitions(foo_static_private INTERFACE FOO_LIBRARY)
+add_library(bang_static_private STATIC bang_vs6_2.cpp)
+target_compile_definitions(bang_static_private INTERFACE BANG_LIBRARY)
+add_library(bar_static_private STATIC bar_vs6_4.cpp)
+target_compile_definitions(bar_static_private INTERFACE BAR_LIBRARY)
+target_compile_definitions(bar_static_private PRIVATE BAR_USE_BANG)
+set_property(TARGET bar_static_private APPEND PROPERTY LINK_LIBRARIES bang_static_private)
+set_property(TARGET bar_static_private APPEND PROPERTY INTERFACE_LINK_LIBRARIES $<LINK_ONLY:bang_static_private> foo_static_private)
+
+add_executable(InterfaceLinkLibraries main_vs6_4.cpp)
+set_property(TARGET InterfaceLinkLibraries APPEND PROPERTY LINK_LIBRARIES bar_static_private)
diff --git a/Tests/InterfaceLinkLibraries/bang.cpp b/Tests/InterfaceLinkLibraries/bang.cpp
new file mode 100644
index 0000000..2e95098
--- /dev/null
+++ b/Tests/InterfaceLinkLibraries/bang.cpp
@@ -0,0 +1,15 @@
+
+#ifdef FOO_LIBRARY
+#error Unexpected FOO_LIBRARY
+#endif
+
+#ifdef BAR_LIBRARY
+#error Unexpected BAR_LIBRARY
+#endif
+
+#include "bang.h"
+
+int bang()
+{
+ return 0;
+}
diff --git a/Tests/InterfaceLinkLibraries/bang.h b/Tests/InterfaceLinkLibraries/bang.h
new file mode 100644
index 0000000..acffb39
--- /dev/null
+++ b/Tests/InterfaceLinkLibraries/bang.h
@@ -0,0 +1,4 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+int bang();
diff --git a/Tests/InterfaceLinkLibraries/bang_vs6_1.cpp b/Tests/InterfaceLinkLibraries/bang_vs6_1.cpp
new file mode 100644
index 0000000..4886861
--- /dev/null
+++ b/Tests/InterfaceLinkLibraries/bang_vs6_1.cpp
@@ -0,0 +1 @@
+#include "bang.cpp"
diff --git a/Tests/InterfaceLinkLibraries/bang_vs6_2.cpp b/Tests/InterfaceLinkLibraries/bang_vs6_2.cpp
new file mode 100644
index 0000000..4886861
--- /dev/null
+++ b/Tests/InterfaceLinkLibraries/bang_vs6_2.cpp
@@ -0,0 +1 @@
+#include "bang.cpp"
diff --git a/Tests/InterfaceLinkLibraries/bar.cpp b/Tests/InterfaceLinkLibraries/bar.cpp
new file mode 100644
index 0000000..f39bfa5
--- /dev/null
+++ b/Tests/InterfaceLinkLibraries/bar.cpp
@@ -0,0 +1,26 @@
+
+#ifdef FOO_LIBRARY
+#error Unexpected FOO_LIBRARY
+#endif
+
+#ifdef BAR_USE_BANG
+# ifndef BANG_LIBRARY
+# error Expected BANG_LIBRARY
+# endif
+# include "bang.h"
+#else
+# ifdef BANG_LIBRARY
+# error Unexpected BANG_LIBRARY
+# endif
+#endif
+
+#include "bar.h"
+
+int bar()
+{
+#ifdef BAR_USE_BANG
+ return bang();
+#else
+ return 0;
+#endif
+}
diff --git a/Tests/InterfaceLinkLibraries/bar.h b/Tests/InterfaceLinkLibraries/bar.h
new file mode 100644
index 0000000..f83b37e
--- /dev/null
+++ b/Tests/InterfaceLinkLibraries/bar.h
@@ -0,0 +1,7 @@
+
+#include "foo.h"
+
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+int bar();
diff --git a/Tests/InterfaceLinkLibraries/bar_vs6_1.cpp b/Tests/InterfaceLinkLibraries/bar_vs6_1.cpp
new file mode 100644
index 0000000..58a04c4
--- /dev/null
+++ b/Tests/InterfaceLinkLibraries/bar_vs6_1.cpp
@@ -0,0 +1 @@
+#include "bar.cpp"
diff --git a/Tests/InterfaceLinkLibraries/bar_vs6_2.cpp b/Tests/InterfaceLinkLibraries/bar_vs6_2.cpp
new file mode 100644
index 0000000..58a04c4
--- /dev/null
+++ b/Tests/InterfaceLinkLibraries/bar_vs6_2.cpp
@@ -0,0 +1 @@
+#include "bar.cpp"
diff --git a/Tests/InterfaceLinkLibraries/bar_vs6_3.cpp b/Tests/InterfaceLinkLibraries/bar_vs6_3.cpp
new file mode 100644
index 0000000..58a04c4
--- /dev/null
+++ b/Tests/InterfaceLinkLibraries/bar_vs6_3.cpp
@@ -0,0 +1 @@
+#include "bar.cpp"
diff --git a/Tests/InterfaceLinkLibraries/bar_vs6_4.cpp b/Tests/InterfaceLinkLibraries/bar_vs6_4.cpp
new file mode 100644
index 0000000..58a04c4
--- /dev/null
+++ b/Tests/InterfaceLinkLibraries/bar_vs6_4.cpp
@@ -0,0 +1 @@
+#include "bar.cpp"
diff --git a/Tests/InterfaceLinkLibraries/foo.cpp b/Tests/InterfaceLinkLibraries/foo.cpp
new file mode 100644
index 0000000..5295707
--- /dev/null
+++ b/Tests/InterfaceLinkLibraries/foo.cpp
@@ -0,0 +1,15 @@
+
+#ifdef BAR_LIBRARY
+#error Unexpected BAR_LIBRARY
+#endif
+
+#ifdef BANG_LIBRARY
+#error Unexpected BANG_LIBRARY
+#endif
+
+#include "foo.h"
+
+int foo()
+{
+ return 0;
+}
diff --git a/Tests/InterfaceLinkLibraries/foo.h b/Tests/InterfaceLinkLibraries/foo.h
new file mode 100644
index 0000000..e12e23c
--- /dev/null
+++ b/Tests/InterfaceLinkLibraries/foo.h
@@ -0,0 +1,4 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+int foo();
diff --git a/Tests/InterfaceLinkLibraries/foo_vs6_1.cpp b/Tests/InterfaceLinkLibraries/foo_vs6_1.cpp
new file mode 100644
index 0000000..d2e5e52
--- /dev/null
+++ b/Tests/InterfaceLinkLibraries/foo_vs6_1.cpp
@@ -0,0 +1 @@
+#include "foo.cpp"
diff --git a/Tests/InterfaceLinkLibraries/foo_vs6_2.cpp b/Tests/InterfaceLinkLibraries/foo_vs6_2.cpp
new file mode 100644
index 0000000..d2e5e52
--- /dev/null
+++ b/Tests/InterfaceLinkLibraries/foo_vs6_2.cpp
@@ -0,0 +1 @@
+#include "foo.cpp"
diff --git a/Tests/InterfaceLinkLibraries/foo_vs6_3.cpp b/Tests/InterfaceLinkLibraries/foo_vs6_3.cpp
new file mode 100644
index 0000000..d2e5e52
--- /dev/null
+++ b/Tests/InterfaceLinkLibraries/foo_vs6_3.cpp
@@ -0,0 +1 @@
+#include "foo.cpp"
diff --git a/Tests/InterfaceLinkLibraries/foo_vs6_4.cpp b/Tests/InterfaceLinkLibraries/foo_vs6_4.cpp
new file mode 100644
index 0000000..d2e5e52
--- /dev/null
+++ b/Tests/InterfaceLinkLibraries/foo_vs6_4.cpp
@@ -0,0 +1 @@
+#include "foo.cpp"
diff --git a/Tests/InterfaceLinkLibraries/main.cpp b/Tests/InterfaceLinkLibraries/main.cpp
new file mode 100644
index 0000000..a54076a
--- /dev/null
+++ b/Tests/InterfaceLinkLibraries/main.cpp
@@ -0,0 +1,19 @@
+
+#ifndef FOO_LIBRARY
+#error Expected FOO_LIBRARY
+#endif
+
+#ifndef BAR_LIBRARY
+#error Expected BAR_LIBRARY
+#endif
+
+#ifdef BANG_LIBRARY
+#error Unexpected BANG_LIBRARY
+#endif
+
+#include "bar.h"
+
+int main(void)
+{
+ return foo() + bar();
+}
diff --git a/Tests/InterfaceLinkLibraries/main_vs6_1.cpp b/Tests/InterfaceLinkLibraries/main_vs6_1.cpp
new file mode 100644
index 0000000..9b10ef2
--- /dev/null
+++ b/Tests/InterfaceLinkLibraries/main_vs6_1.cpp
@@ -0,0 +1 @@
+#include "main.cpp"
diff --git a/Tests/InterfaceLinkLibraries/main_vs6_2.cpp b/Tests/InterfaceLinkLibraries/main_vs6_2.cpp
new file mode 100644
index 0000000..9b10ef2
--- /dev/null
+++ b/Tests/InterfaceLinkLibraries/main_vs6_2.cpp
@@ -0,0 +1 @@
+#include "main.cpp"
diff --git a/Tests/InterfaceLinkLibraries/main_vs6_3.cpp b/Tests/InterfaceLinkLibraries/main_vs6_3.cpp
new file mode 100644
index 0000000..9b10ef2
--- /dev/null
+++ b/Tests/InterfaceLinkLibraries/main_vs6_3.cpp
@@ -0,0 +1 @@
+#include "main.cpp"
diff --git a/Tests/InterfaceLinkLibraries/main_vs6_4.cpp b/Tests/InterfaceLinkLibraries/main_vs6_4.cpp
new file mode 100644
index 0000000..9b10ef2
--- /dev/null
+++ b/Tests/InterfaceLinkLibraries/main_vs6_4.cpp
@@ -0,0 +1 @@
+#include "main.cpp"
diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-link_libraries-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-link_libraries-stderr.txt
new file mode 100644
index 0000000..10f3293
--- /dev/null
+++ b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-link_libraries-stderr.txt
@@ -0,0 +1 @@
+^$
diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-link_libraries.cmake b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-link_libraries.cmake
new file mode 100644
index 0000000..42c4084
--- /dev/null
+++ b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-link_libraries.cmake
@@ -0,0 +1,9 @@
+
+enable_language(CXX)
+
+add_subdirectory(dep1)
+add_subdirectory(dep2)
+add_subdirectory(dep3)
+
+add_library(somelib empty.cpp)
+target_link_libraries(somelib dep3)
diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-stderr.txt
new file mode 100644
index 0000000..10f3293
--- /dev/null
+++ b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-stderr.txt
@@ -0,0 +1 @@
+^$
diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static.cmake b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static.cmake
new file mode 100644
index 0000000..3e4144f
--- /dev/null
+++ b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static.cmake
@@ -0,0 +1,8 @@
+
+project(CMP0022-NOWARN-static)
+
+add_library(foo STATIC empty_vs6_1.cpp)
+add_library(bar STATIC empty_vs6_2.cpp)
+add_library(bat STATIC empty_vs6_3.cpp)
+target_link_libraries(foo bar)
+target_link_libraries(bar bat)
diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-static-result.txt b/Tests/RunCMake/CMP0022/CMP0022-WARN-static-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CMP0022/CMP0022-WARN-static-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-static-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-WARN-static-stderr.txt
new file mode 100644
index 0000000..41d132c
--- /dev/null
+++ b/Tests/RunCMake/CMP0022/CMP0022-WARN-static-stderr.txt
@@ -0,0 +1,10 @@
+CMake Warning \(dev\) in CMakeLists.txt:
+ Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link
+ interface. Run "cmake --help-policy CMP0022" for policy details. Use the
+ cmake_policy command to set the policy and suppress this warning.
+
+ Static library target "bar" has a INTERFACE_LINK_LIBRARIES property. This
+ should be preferred as the source of the link interface for this library.
+ Ignoring the property and using the link implementation as the link
+ interface instead.
+This warning is for project developers. Use -Wno-dev to suppress it.$
diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-static.cmake b/Tests/RunCMake/CMP0022/CMP0022-WARN-static.cmake
new file mode 100644
index 0000000..b3cb131
--- /dev/null
+++ b/Tests/RunCMake/CMP0022/CMP0022-WARN-static.cmake
@@ -0,0 +1,11 @@
+
+project(CMP0022-WARN)
+
+add_library(foo STATIC empty_vs6_1.cpp)
+add_library(bar STATIC empty_vs6_2.cpp)
+add_library(bat STATIC empty_vs6_3.cpp)
+set_property(TARGET bar PROPERTY INTERFACE_LINK_LIBRARIES foo)
+set_property(TARGET bar PROPERTY LINK_LIBRARIES bat)
+
+add_library(user empty.cpp)
+target_link_libraries(user bar)
diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-WARN-stderr.txt
new file mode 100644
index 0000000..29103c9
--- /dev/null
+++ b/Tests/RunCMake/CMP0022/CMP0022-WARN-stderr.txt
@@ -0,0 +1,8 @@
+CMake Warning \(dev\) in CMakeLists.txt:
+ Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link
+ interface. Run "cmake --help-policy CMP0022" for policy details. Use the
+ cmake_policy command to set the policy and suppress this warning.
+
+ Target "bar" has a INTERFACE_LINK_LIBRARIES property which differs from its
+ LINK_INTERFACE_LIBRARIES properties.
+This warning is for project developers. Use -Wno-dev to suppress it.$
diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-tll-result.txt b/Tests/RunCMake/CMP0022/CMP0022-WARN-tll-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CMP0022/CMP0022-WARN-tll-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-tll-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-WARN-tll-stderr.txt
new file mode 100644
index 0000000..5a5ad27
--- /dev/null
+++ b/Tests/RunCMake/CMP0022/CMP0022-WARN-tll-stderr.txt
@@ -0,0 +1,8 @@
+CMake Warning \(dev\) in CMakeLists.txt:
+ Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link
+ interface. Run "cmake --help-policy CMP0022" for policy details. Use the
+ cmake_policy command to set the policy and suppress this warning.
+
+ Target "bar" has a INTERFACE_LINK_LIBRARIES property which differs from its
+ LINK_INTERFACE_LIBRARIES properties.
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-tll.cmake b/Tests/RunCMake/CMP0022/CMP0022-WARN-tll.cmake
new file mode 100644
index 0000000..11b4e22
--- /dev/null
+++ b/Tests/RunCMake/CMP0022/CMP0022-WARN-tll.cmake
@@ -0,0 +1,11 @@
+
+project(CMP0022-WARN-tll)
+
+add_library(foo SHARED empty_vs6_1.cpp)
+add_library(bar SHARED empty_vs6_2.cpp)
+add_library(bat SHARED empty_vs6_3.cpp)
+target_link_libraries(bar LINK_PUBLIC foo)
+set_property(TARGET bar PROPERTY LINK_INTERFACE_LIBRARIES bat)
+
+add_library(user SHARED empty.cpp)
+target_link_libraries(user bar)
diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN.cmake b/Tests/RunCMake/CMP0022/CMP0022-WARN.cmake
new file mode 100644
index 0000000..24b7f45
--- /dev/null
+++ b/Tests/RunCMake/CMP0022/CMP0022-WARN.cmake
@@ -0,0 +1,11 @@
+
+project(CMP0022-WARN)
+
+add_library(foo SHARED empty_vs6_1.cpp)
+add_library(bar SHARED empty_vs6_2.cpp)
+add_library(bat SHARED empty_vs6_3.cpp)
+set_property(TARGET bar PROPERTY INTERFACE_LINK_LIBRARIES foo)
+set_property(TARGET bar PROPERTY LINK_INTERFACE_LIBRARIES bat)
+
+add_library(user empty.cpp)
+target_link_libraries(user bar)
diff --git a/Tests/RunCMake/CMP0022/CMP0022-export-result.txt b/Tests/RunCMake/CMP0022/CMP0022-export-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0022/CMP0022-export-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0022/CMP0022-export-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-export-stderr.txt
new file mode 100644
index 0000000..6c29057
--- /dev/null
+++ b/Tests/RunCMake/CMP0022/CMP0022-export-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at CMP0022-export.cmake:11 \(export\):
+ Target "cmp0022NEW" has policy CMP0022 enabled, but also has old-style
+ INTERFACE_LINK_LIBRARIES properties populated, but it was exported without
+ the EXPORT_LINK_INTERFACE_LIBRARIES to export the old-style properties
diff --git a/Tests/RunCMake/CMP0022/CMP0022-export.cmake b/Tests/RunCMake/CMP0022/CMP0022-export.cmake
new file mode 100644
index 0000000..06147f3
--- /dev/null
+++ b/Tests/RunCMake/CMP0022/CMP0022-export.cmake
@@ -0,0 +1,11 @@
+
+project(cmp0022NEW)
+
+cmake_policy(SET CMP0022 NEW)
+
+add_library(cmp0022NEW SHARED empty_vs6_1.cpp)
+add_library(testLib SHARED empty_vs6_2.cpp)
+
+set_property(TARGET cmp0022NEW APPEND PROPERTY LINK_INTERFACE_LIBRARIES testLib)
+
+export(TARGETS cmp0022NEW testLib FILE "${CMAKE_CURRENT_BINARY_DIR}/cmp0022NEW.cmake")
diff --git a/Tests/RunCMake/CMP0022/CMP0022-install-export-result.txt b/Tests/RunCMake/CMP0022/CMP0022-install-export-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0022/CMP0022-install-export-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0022/CMP0022-install-export-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-install-export-stderr.txt
new file mode 100644
index 0000000..3425e8e
--- /dev/null
+++ b/Tests/RunCMake/CMP0022/CMP0022-install-export-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error in CMakeLists.txt:
+ Target "cmp0022NEW" has policy CMP0022 enabled, but also has old-style
+ INTERFACE_LINK_LIBRARIES properties populated, but it was exported without
+ the EXPORT_LINK_INTERFACE_LIBRARIES to export the old-style properties
diff --git a/Tests/RunCMake/CMP0022/CMP0022-install-export.cmake b/Tests/RunCMake/CMP0022/CMP0022-install-export.cmake
new file mode 100644
index 0000000..171febe
--- /dev/null
+++ b/Tests/RunCMake/CMP0022/CMP0022-install-export.cmake
@@ -0,0 +1,12 @@
+
+project(cmp0022NEW)
+
+cmake_policy(SET CMP0022 NEW)
+
+add_library(cmp0022NEW SHARED empty_vs6_1.cpp)
+add_library(testLib SHARED empty_vs6_2.cpp)
+
+set_property(TARGET cmp0022NEW APPEND PROPERTY LINK_INTERFACE_LIBRARIES testLib)
+
+install(TARGETS cmp0022NEW testLib EXPORT exp DESTINATION lib)
+install(EXPORT exp FILE expTargets.cmake DESTINATION lib/cmake/exp)
diff --git a/Tests/RunCMake/CMP0022/CMakeLists.txt b/Tests/RunCMake/CMP0022/CMakeLists.txt
new file mode 100644
index 0000000..72abfc8
--- /dev/null
+++ b/Tests/RunCMake/CMP0022/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8.11)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0022/RunCMakeTest.cmake b/Tests/RunCMake/CMP0022/RunCMakeTest.cmake
new file mode 100644
index 0000000..dcef0f5
--- /dev/null
+++ b/Tests/RunCMake/CMP0022/RunCMakeTest.cmake
@@ -0,0 +1,9 @@
+include(RunCMake)
+
+run_cmake(CMP0022-WARN)
+run_cmake(CMP0022-WARN-tll)
+run_cmake(CMP0022-WARN-static)
+run_cmake(CMP0022-NOWARN-static)
+run_cmake(CMP0022-NOWARN-static-link_libraries)
+run_cmake(CMP0022-export)
+run_cmake(CMP0022-install-export)
diff --git a/Tests/RunCMake/CMP0022/dep1/CMakeLists.txt b/Tests/RunCMake/CMP0022/dep1/CMakeLists.txt
new file mode 100644
index 0000000..f0a8179
--- /dev/null
+++ b/Tests/RunCMake/CMP0022/dep1/CMakeLists.txt
@@ -0,0 +1,2 @@
+
+add_library(dep1 ../empty_vs6_1.cpp)
diff --git a/Tests/RunCMake/CMP0022/dep2/CMakeLists.txt b/Tests/RunCMake/CMP0022/dep2/CMakeLists.txt
new file mode 100644
index 0000000..4f90162
--- /dev/null
+++ b/Tests/RunCMake/CMP0022/dep2/CMakeLists.txt
@@ -0,0 +1,2 @@
+
+add_library(dep2 ../empty_vs6_2.cpp)
diff --git a/Tests/RunCMake/CMP0022/dep3/CMakeLists.txt b/Tests/RunCMake/CMP0022/dep3/CMakeLists.txt
new file mode 100644
index 0000000..e85cb54
--- /dev/null
+++ b/Tests/RunCMake/CMP0022/dep3/CMakeLists.txt
@@ -0,0 +1,5 @@
+
+link_libraries(dep1)
+
+add_library(dep3 ../empty_vs6_3.cpp)
+target_link_libraries(dep3 dep2)
diff --git a/Tests/RunCMake/CMP0022/empty.cpp b/Tests/RunCMake/CMP0022/empty.cpp
new file mode 100644
index 0000000..bfbbdde
--- /dev/null
+++ b/Tests/RunCMake/CMP0022/empty.cpp
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+int empty()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CMP0022/empty_vs6_1.cpp b/Tests/RunCMake/CMP0022/empty_vs6_1.cpp
new file mode 100644
index 0000000..7efedab
--- /dev/null
+++ b/Tests/RunCMake/CMP0022/empty_vs6_1.cpp
@@ -0,0 +1 @@
+#include "empty.cpp"
diff --git a/Tests/RunCMake/CMP0022/empty_vs6_2.cpp b/Tests/RunCMake/CMP0022/empty_vs6_2.cpp
new file mode 100644
index 0000000..7efedab
--- /dev/null
+++ b/Tests/RunCMake/CMP0022/empty_vs6_2.cpp
@@ -0,0 +1 @@
+#include "empty.cpp"
diff --git a/Tests/RunCMake/CMP0022/empty_vs6_3.cpp b/Tests/RunCMake/CMP0022/empty_vs6_3.cpp
new file mode 100644
index 0000000..7efedab
--- /dev/null
+++ b/Tests/RunCMake/CMP0022/empty_vs6_3.cpp
@@ -0,0 +1 @@
+#include "empty.cpp"
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index c1a08d2..66ce3f1 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -52,10 +52,12 @@ if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 3)
endif()
add_RunCMake_test(CMP0019)
+add_RunCMake_test(CMP0022)
add_RunCMake_test(CTest)
if(UNIX AND "${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles")
add_RunCMake_test(CompilerChange)
endif()
+add_RunCMake_test(Configure)
add_RunCMake_test(ExternalData)
add_RunCMake_test(FPHSA)
add_RunCMake_test(GeneratorExpression)
@@ -95,12 +97,17 @@ add_RunCMake_test(list)
add_RunCMake_test(try_compile)
add_RunCMake_test(variable_watch)
add_RunCMake_test(CMP0004)
+add_RunCMake_test(TargetPolicies)
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)
diff --git a/Tests/RunCMake/Configure/CMakeLists.txt b/Tests/RunCMake/Configure/CMakeLists.txt
new file mode 100644
index 0000000..e8db6b0
--- /dev/null
+++ b/Tests/RunCMake/Configure/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/Configure/ErrorLogs-result.txt b/Tests/RunCMake/Configure/ErrorLogs-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/Configure/ErrorLogs-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/Configure/ErrorLogs-stderr.txt b/Tests/RunCMake/Configure/ErrorLogs-stderr.txt
new file mode 100644
index 0000000..4eee45d
--- /dev/null
+++ b/Tests/RunCMake/Configure/ErrorLogs-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at ErrorLogs.cmake:3 \(message\):
+ Some error!
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Configure/ErrorLogs-stdout.txt b/Tests/RunCMake/Configure/ErrorLogs-stdout.txt
new file mode 100644
index 0000000..c467b62
--- /dev/null
+++ b/Tests/RunCMake/Configure/ErrorLogs-stdout.txt
@@ -0,0 +1,3 @@
+-- Configuring incomplete, errors occurred!
+See also ".*/Tests/RunCMake/Configure/ErrorLogs-build/CMakeFiles/CMakeOutput\.log"\.
+See also ".*/Tests/RunCMake/Configure/ErrorLogs-build/CMakeFiles/CMakeError\.log"\.
diff --git a/Tests/RunCMake/Configure/ErrorLogs.cmake b/Tests/RunCMake/Configure/ErrorLogs.cmake
new file mode 100644
index 0000000..e8cf062
--- /dev/null
+++ b/Tests/RunCMake/Configure/ErrorLogs.cmake
@@ -0,0 +1,3 @@
+file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Some detailed error information!\n")
+message(SEND_ERROR "Some error!")
diff --git a/Tests/RunCMake/Configure/RunCMakeTest.cmake b/Tests/RunCMake/Configure/RunCMakeTest.cmake
new file mode 100644
index 0000000..46f9184
--- /dev/null
+++ b/Tests/RunCMake/Configure/RunCMakeTest.cmake
@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake(ErrorLogs)
diff --git a/Tests/RunCMake/ObsoleteQtMacros/AutomocMacro-WARN-result.txt b/Tests/RunCMake/ObsoleteQtMacros/AutomocMacro-WARN-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/ObsoleteQtMacros/AutomocMacro-WARN-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/ObsoleteQtMacros/AutomocMacro-WARN-stderr.txt b/Tests/RunCMake/ObsoleteQtMacros/AutomocMacro-WARN-stderr.txt
new file mode 100644
index 0000000..6f7e8ee
--- /dev/null
+++ b/Tests/RunCMake/ObsoleteQtMacros/AutomocMacro-WARN-stderr.txt
@@ -0,0 +1,5 @@
+CMake Warning at .*/Modules/Qt4Macros.cmake:[^ ]+ \(message\):
+ The qt4_automoc macro is obsolete. Use the CMAKE_AUTOMOC feature instead.
+Call Stack \(most recent call first\):
+ AutomocMacro-WARN.cmake:7 \(qt4_automoc\)
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/ObsoleteQtMacros/AutomocMacro-WARN.cmake b/Tests/RunCMake/ObsoleteQtMacros/AutomocMacro-WARN.cmake
new file mode 100644
index 0000000..c0c64a5
--- /dev/null
+++ b/Tests/RunCMake/ObsoleteQtMacros/AutomocMacro-WARN.cmake
@@ -0,0 +1,7 @@
+
+find_package(Qt4 REQUIRED)
+
+set(CMAKE_WARN_DEPRECATED 1)
+
+add_library(foo SHARED empty.cpp)
+qt4_automoc(foo_moc_srcs empty.cpp)
diff --git a/Tests/RunCMake/ObsoleteQtMacros/CMakeLists.txt b/Tests/RunCMake/ObsoleteQtMacros/CMakeLists.txt
new file mode 100644
index 0000000..65ac8e8
--- /dev/null
+++ b/Tests/RunCMake/ObsoleteQtMacros/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8.11)
+project(${RunCMake_TEST})
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/ObsoleteQtMacros/RunCMakeTest.cmake b/Tests/RunCMake/ObsoleteQtMacros/RunCMakeTest.cmake
new file mode 100644
index 0000000..eee2cc3
--- /dev/null
+++ b/Tests/RunCMake/ObsoleteQtMacros/RunCMakeTest.cmake
@@ -0,0 +1,6 @@
+include(RunCMake)
+
+set(RunCMake_TEST_OPTIONS -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE})
+
+run_cmake(UseModulesMacro-WARN)
+run_cmake(AutomocMacro-WARN)
diff --git a/Tests/RunCMake/ObsoleteQtMacros/UseModulesMacro-WARN-result.txt b/Tests/RunCMake/ObsoleteQtMacros/UseModulesMacro-WARN-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/ObsoleteQtMacros/UseModulesMacro-WARN-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/ObsoleteQtMacros/UseModulesMacro-WARN-stderr.txt b/Tests/RunCMake/ObsoleteQtMacros/UseModulesMacro-WARN-stderr.txt
new file mode 100644
index 0000000..b90c665
--- /dev/null
+++ b/Tests/RunCMake/ObsoleteQtMacros/UseModulesMacro-WARN-stderr.txt
@@ -0,0 +1,6 @@
+CMake Warning at .*/Modules/Qt4Macros.cmake:[^ ]+ \(message\):
+ The qt4_use_modules function is obsolete. Use target_link_libraries with
+ IMPORTED targets instead.
+Call Stack \(most recent call first\):
+ UseModulesMacro-WARN.cmake:[^ ]+ \(qt4_use_modules\)
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/ObsoleteQtMacros/UseModulesMacro-WARN.cmake b/Tests/RunCMake/ObsoleteQtMacros/UseModulesMacro-WARN.cmake
new file mode 100644
index 0000000..e86a372
--- /dev/null
+++ b/Tests/RunCMake/ObsoleteQtMacros/UseModulesMacro-WARN.cmake
@@ -0,0 +1,7 @@
+
+find_package(Qt4 REQUIRED)
+
+set(CMAKE_WARN_DEPRECATED 1)
+
+add_library(foo SHARED empty.cpp)
+qt4_use_modules(foo LINK_PRIVATE Core)
diff --git a/Tests/RunCMake/ObsoleteQtMacros/empty.cpp b/Tests/RunCMake/ObsoleteQtMacros/empty.cpp
new file mode 100644
index 0000000..7279c5e
--- /dev/null
+++ b/Tests/RunCMake/ObsoleteQtMacros/empty.cpp
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+int empty(void)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/TargetPolicies/CMakeLists.txt b/Tests/RunCMake/TargetPolicies/CMakeLists.txt
new file mode 100644
index 0000000..e8db6b0
--- /dev/null
+++ b/Tests/RunCMake/TargetPolicies/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-result.txt b/Tests/RunCMake/TargetPolicies/PolicyList-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/TargetPolicies/PolicyList-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
new file mode 100644
index 0000000..6533b75
--- /dev/null
+++ b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
@@ -0,0 +1,13 @@
+ Error evaluating generator expression:
+
+ \$<TARGET_POLICY:NOT_A_POLICY>
+
+ \$<TARGET_POLICY:prop> may only be used with a limited number of policies.
+ Currently it may be used with the following policies:
+
+ \* CMP0003
+ \* CMP0004
+ \* CMP0008
+ \* CMP0020
+ \* CMP0021
+ \* CMP0022
diff --git a/Tests/RunCMake/TargetPolicies/PolicyList.cmake b/Tests/RunCMake/TargetPolicies/PolicyList.cmake
new file mode 100644
index 0000000..c290b65
--- /dev/null
+++ b/Tests/RunCMake/TargetPolicies/PolicyList.cmake
@@ -0,0 +1,8 @@
+
+enable_language(CXX)
+
+add_library(empty empty.cpp)
+target_compile_definitions(empty
+ PRIVATE
+ $<$<TARGET_POLICY:NOT_A_POLICY>:SOME_DEFINE>
+)
diff --git a/Tests/RunCMake/TargetPolicies/RunCMakeTest.cmake b/Tests/RunCMake/TargetPolicies/RunCMakeTest.cmake
new file mode 100644
index 0000000..7a94630
--- /dev/null
+++ b/Tests/RunCMake/TargetPolicies/RunCMakeTest.cmake
@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake(PolicyList)
diff --git a/Tests/RunCMake/TargetPolicies/empty.cpp b/Tests/RunCMake/TargetPolicies/empty.cpp
new file mode 100644
index 0000000..7279c5e
--- /dev/null
+++ b/Tests/RunCMake/TargetPolicies/empty.cpp
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+int empty(void)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile-result.txt b/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile-stderr.txt b/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile-stderr.txt
new file mode 100644
index 0000000..5d09c0c
--- /dev/null
+++ b/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at CopyFileErrorNoCopyFile.cmake:1 \(try_compile\):
+ COPY_FILE_ERROR may be used only with COPY_FILE
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile.cmake b/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile.cmake
new file mode 100644
index 0000000..8d7cb0e
--- /dev/null
+++ b/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile.cmake
@@ -0,0 +1,2 @@
+try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+ COPY_FILE_ERROR _copied)
diff --git a/Tests/RunCMake/try_compile/NoCopyFileError-result.txt b/Tests/RunCMake/try_compile/NoCopyFileError-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/try_compile/NoCopyFileError-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_compile/NoCopyFileError-stderr.txt b/Tests/RunCMake/try_compile/NoCopyFileError-stderr.txt
new file mode 100644
index 0000000..ed552fd
--- /dev/null
+++ b/Tests/RunCMake/try_compile/NoCopyFileError-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at NoCopyFileError.cmake:1 \(try_compile\):
+ COPY_FILE_ERROR must be followed by a variable name
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/NoCopyFileError.cmake b/Tests/RunCMake/try_compile/NoCopyFileError.cmake
new file mode 100644
index 0000000..d4d69ee
--- /dev/null
+++ b/Tests/RunCMake/try_compile/NoCopyFileError.cmake
@@ -0,0 +1,2 @@
+try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+ COPY_FILE ${CMAKE_CURRENT_BINARY_DIR}/copied.bin COPY_FILE_ERROR)
diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
index 3494695..c934458 100644
--- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake
+++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
@@ -1,10 +1,12 @@
include(RunCMake)
+run_cmake(CopyFileErrorNoCopyFile)
run_cmake(NoArgs)
run_cmake(OneArg)
run_cmake(TwoArgs)
run_cmake(NoCopyFile)
run_cmake(NoCopyFile2)
+run_cmake(NoCopyFileError)
run_cmake(NoOutputVariable)
run_cmake(NoOutputVariable2)
run_cmake(NoSources)
diff --git a/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt
index 4540fd0..a4d9490 100644
--- a/Tests/TryCompile/CMakeLists.txt
+++ b/Tests/TryCompile/CMakeLists.txt
@@ -44,6 +44,23 @@ else()
file(REMOVE "${TryCompile_BINARY_DIR}/CopyOfPass")
endif()
+# try to compile a file that should compile
+# also check that COPY_FILE_ERROR works
+file(WRITE ${TryCompile_BINARY_DIR}/invalid "")
+try_compile(SHOULD_PASS
+ ${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
+ ${TryCompile_SOURCE_DIR}/pass.c
+ OUTPUT_VARIABLE TRY_OUT
+ COPY_FILE ${TryCompile_BINARY_DIR}/invalid/path
+ COPY_FILE_ERROR _captured
+ )
+if(NOT SHOULD_PASS)
+ message(SEND_ERROR "should pass failed ${TRY_OUT}")
+endif()
+if(NOT _captured MATCHES "Cannot copy output executable.*/invalid/path")
+ message(SEND_ERROR "COPY_FILE_ERROR did not capture expected message")
+endif()
+
# try to compile a file that should not compile
try_compile(SHOULD_FAIL
${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
@@ -89,6 +106,24 @@ if(SHOULD_FAIL)
message(SEND_ERROR "Should fail passed ${TRY_OUT}")
endif()
+# try to compile a file that should compile
+set(_c_flags "${CMAKE_C_FLAGS}")
+if(CMAKE_GENERATOR STREQUAL "Visual Studio 6")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D \"TESTDEF\"")
+elseif(WATCOM)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -dTESTDEF")
+else()
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} \"-DTESTDEF\"")
+endif()
+try_compile(SHOULD_PASS
+ ${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
+ ${TryCompile_SOURCE_DIR}/testdef.c
+ OUTPUT_VARIABLE TRY_OUT)
+if(NOT SHOULD_PASS)
+ message(SEND_ERROR "should pass failed ${TRY_OUT}")
+endif()
+set(CMAKE_C_FLAGS "${_c_flags}")
+
if(NOT SHOULD_FAIL)
if(SHOULD_PASS)
message("All Tests passed, ignore all previous output.")
diff --git a/Tests/TryCompile/testdef.c b/Tests/TryCompile/testdef.c
new file mode 100644
index 0000000..5401e71
--- /dev/null
+++ b/Tests/TryCompile/testdef.c
@@ -0,0 +1,4 @@
+#ifndef TESTDEF
+# error "TESTDEF should be defined!"
+#endif
+int main(void) { return 0; }
diff --git a/Utilities/cmcurl/Testing/sepheaders.c b/Utilities/cmcurl/Testing/sepheaders.c
index 8185787..fc5b783 100644
--- a/Utilities/cmcurl/Testing/sepheaders.c
+++ b/Utilities/cmcurl/Testing/sepheaders.c
@@ -56,6 +56,7 @@ int main(int argc, char **argv)
bodyfile = fopen(bodyfilename,"w");
if (bodyfile == NULL) {
curl_easy_cleanup(curl_handle);
+ fclose(headerfile);
return -1;
}
@@ -70,6 +71,7 @@ int main(int argc, char **argv)
/* close the header file */
fclose(headerfile);
+ fclose(bodyfile);
/* cleanup curl stuff */
curl_easy_cleanup(curl_handle);
diff --git a/Utilities/cmcurl/Testing/simplessl.c b/Utilities/cmcurl/Testing/simplessl.c
index 9a53603..e307eaa 100644
--- a/Utilities/cmcurl/Testing/simplessl.c
+++ b/Utilities/cmcurl/Testing/simplessl.c
@@ -114,5 +114,7 @@ int main(int argc, char **argv)
curl_global_cleanup();
+ if (headerfile)
+ fclose(headerfile);
return 0;
}
diff --git a/Utilities/cmcurl/cookie.c b/Utilities/cmcurl/cookie.c
index 2856ad8..d8ea241 100644
--- a/Utilities/cmcurl/cookie.c
+++ b/Utilities/cmcurl/cookie.c
@@ -969,6 +969,8 @@ int Curl_cookie_output(struct CookieInfo *c, char *dumphere)
format_ptr = get_netscape_format(co);
if (format_ptr == NULL) {
fprintf(out, "#\n# Fatal libcurl error\n");
+ if(!use_stdout)
+ fclose(out);
return 1;
}
fprintf(out, "%s\n", format_ptr);
diff --git a/Utilities/cmlibarchive/libarchive/archive_string.c b/Utilities/cmlibarchive/libarchive/archive_string.c
index cbfad2c..370a5fc 100644
--- a/Utilities/cmlibarchive/libarchive/archive_string.c
+++ b/Utilities/cmlibarchive/libarchive/archive_string.c
@@ -1248,8 +1248,8 @@ create_sconv_object(const char *fc, const char *tc,
}
sc->to_charset = strdup(tc);
if (sc->to_charset == NULL) {
- free(sc);
free(sc->from_charset);
+ free(sc);
return (NULL);
}
archive_string_init(&sc->utftmp);