summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-01-09 14:37:20 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2014-01-09 14:37:20 (GMT)
commit15562c11efa3c3a9e0f28f9ad52b71623c254b05 (patch)
tree24dfd93e75c0fb8bf618394d379d45cf2f458c49
parent69c366a28178027a5cf2629c0240d1709ae9ab55 (diff)
parent73e93400e2efab2096618ff58a5ad68236cd04aa (diff)
downloadCMake-15562c11efa3c3a9e0f28f9ad52b71623c254b05.zip
CMake-15562c11efa3c3a9e0f28f9ad52b71623c254b05.tar.gz
CMake-15562c11efa3c3a9e0f28f9ad52b71623c254b05.tar.bz2
Merge topic 'policies'
73e9340 get_target_property: Error on non-existent target. ab9f58f FindQt4: Ensure target exists before calling get_target_property. 37ebeb9 FindQt4: Fix use of get_target_property to use actual target name. 6aabb6a Genex: Use case-sensitive comparison for COMPILER_ID. 5bb53f6 cmTarget: Deprecate COMPILE_DEFINITIONS_ properties with a policy.
-rw-r--r--Help/manual/cmake-policies.7.rst3
-rw-r--r--Help/policy/CMP0043.rst39
-rw-r--r--Help/policy/CMP0044.rst19
-rw-r--r--Help/policy/CMP0045.rst17
-rw-r--r--Modules/FindQt4.cmake26
-rw-r--r--Source/cmGeneratorExpressionEvaluator.cxx31
-rw-r--r--Source/cmGetTargetPropertyCommand.cxx31
-rw-r--r--Source/cmGlobalGenerator.cxx23
-rw-r--r--Source/cmMakefile.cxx28
-rw-r--r--Source/cmPolicies.cxx15
-rw-r--r--Source/cmPolicies.h3
-rw-r--r--Source/cmTarget.cxx36
-rw-r--r--Tests/CompileDefinitions/compiletest.c4
-rw-r--r--Tests/CompileDefinitions/target_prop/CMakeLists.txt3
-rw-r--r--Tests/GeneratorExpression/CMP0044/CMakeLists.txt19
-rw-r--r--Tests/GeneratorExpression/CMP0044/cmp0044-check.cpp26
-rw-r--r--Tests/GeneratorExpression/CMakeLists.txt6
-rw-r--r--Tests/RunCMake/CMP0043/CMP0043-NEW-result.txt1
-rw-r--r--Tests/RunCMake/CMP0043/CMP0043-NEW-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0043/CMP0043-NEW.cmake7
-rw-r--r--Tests/RunCMake/CMP0043/CMP0043-OLD-result.txt1
-rw-r--r--Tests/RunCMake/CMP0043/CMP0043-OLD-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0043/CMP0043-OLD.cmake7
-rw-r--r--Tests/RunCMake/CMP0043/CMP0043-WARN-result.txt1
-rw-r--r--Tests/RunCMake/CMP0043/CMP0043-WARN-stderr.txt5
-rw-r--r--Tests/RunCMake/CMP0043/CMP0043-WARN.cmake5
-rw-r--r--Tests/RunCMake/CMP0043/CMakeLists.txt7
-rw-r--r--Tests/RunCMake/CMP0043/RunCMakeTest.cmake7
-rw-r--r--Tests/RunCMake/CMP0043/empty.cpp7
-rw-r--r--Tests/RunCMake/CMP0045/CMP0045-NEW-result.txt1
-rw-r--r--Tests/RunCMake/CMP0045/CMP0045-NEW-stderr.txt4
-rw-r--r--Tests/RunCMake/CMP0045/CMP0045-NEW.cmake4
-rw-r--r--Tests/RunCMake/CMP0045/CMP0045-OLD-result.txt1
-rw-r--r--Tests/RunCMake/CMP0045/CMP0045-OLD-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0045/CMP0045-OLD.cmake4
-rw-r--r--Tests/RunCMake/CMP0045/CMP0045-WARN-result.txt1
-rw-r--r--Tests/RunCMake/CMP0045/CMP0045-WARN-stderr.txt9
-rw-r--r--Tests/RunCMake/CMP0045/CMP0045-WARN.cmake2
-rw-r--r--Tests/RunCMake/CMP0045/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/CMP0045/RunCMakeTest.cmake5
-rw-r--r--Tests/RunCMake/CMP0045/empty.cpp7
-rw-r--r--Tests/RunCMake/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/GeneratorExpression/CMP0044-WARN-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorExpression/CMP0044-WARN-stderr.txt7
-rw-r--r--Tests/RunCMake/GeneratorExpression/CMP0044-WARN.cmake17
-rw-r--r--Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake1
46 files changed, 405 insertions, 44 deletions
diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst
index 9138660..c9f39c4 100644
--- a/Help/manual/cmake-policies.7.rst
+++ b/Help/manual/cmake-policies.7.rst
@@ -92,3 +92,6 @@ All Policies
/policy/CMP0040
/policy/CMP0041
/policy/CMP0042
+ /policy/CMP0043
+ /policy/CMP0044
+ /policy/CMP0045
diff --git a/Help/policy/CMP0043.rst b/Help/policy/CMP0043.rst
new file mode 100644
index 0000000..89a6cde
--- /dev/null
+++ b/Help/policy/CMP0043.rst
@@ -0,0 +1,39 @@
+CMP0043
+-------
+
+Ignore COMPILE_DEFINITIONS_<Config> properties
+
+CMake 2.8.12 and lower allowed setting the
+:prop_tgt:`COMPILE_DEFINITIONS_<CONFIG>` target property and
+:prop_dir:`COMPILE_DEFINITIONS_<CONFIG>` directory property to apply
+configuration-specific compile definitions.
+
+Since CMake 2.8.10, the :prop_tgt:`COMPILE_DEFINITIONS` property has supported
+:manual:`generator expressions <cmake-generator-expressions(7)>` for setting
+configuration-dependent content. The continued existence of the suffixed
+variables is redundant, and causes a maintenance burden. Population of the
+:prop_tgt:`COMPILE_DEFINITIONS_DEBUG <COMPILE_DEFINITIONS_<CONFIG>>` property
+may be replaced with a population of :prop_tgt:`COMPILE_DEFINITIONS` directly
+or via :command:`target_compile_definitions`:
+
+.. code-block:: cmake
+
+ # Old Interface:
+ set_property(TARGET tgt APPEND PROPERTY
+ COMPILE_DEFINITIONS_DEBUG DEBUG_MODE
+ )
+
+ # New Interfaces:
+ set_property(TARGET tgt APPEND PROPERTY
+ COMPILE_DEFINITIONS $<$<CONFIG:Debug>:DEBUG_MODE>
+ )
+ target_compile_definitions(tgt PRIVATE $<$<CONFIG:Debug>:DEBUG_MODE>)
+
+The OLD behavior for this policy is to consume the content of the suffixed
+:prop_tgt:`COMPILE_DEFINITIONS_<CONFIG>` target property when generating the
+compilation command. The NEW behavior for this policy is to ignore the content
+of the :prop_tgt:`COMPILE_DEFINITIONS_<CONFIG>` target property .
+
+This policy was introduced in CMake version 3.0.0. CMake version
+|release| warns when the policy is not set and uses OLD behavior. Use
+the cmake_policy command to set it to OLD or NEW explicitly.
diff --git a/Help/policy/CMP0044.rst b/Help/policy/CMP0044.rst
new file mode 100644
index 0000000..edbadf5
--- /dev/null
+++ b/Help/policy/CMP0044.rst
@@ -0,0 +1,19 @@
+CMP0044
+-------
+
+Case sensitive ``<LANG>_COMPILER_ID`` generator expressions
+
+CMake 2.8.12 introduced the ``<LANG>_COMPILER_ID``
+:manual:`generator expressions <cmake-generator-expressions(7)>` to allow
+comparison of the :variable:`CMAKE_<LANG>_COMPILER_ID` with a test value. The
+possible valid values are lowercase, but the comparison with the test value
+was performed case-insensitively.
+
+The OLD behavior for this policy is to perform a case-insensitive comparison
+with the value in the ``<LANG>_COMPILER_ID`` expression. The NEW behavior
+for this policy is to perform a case-sensitive comparison with the value in
+the ``<LANG>_COMPILER_ID`` expression.
+
+This policy was introduced in CMake version 3.0.0. CMake version
+|release| warns when the policy is not set and uses OLD behavior. Use
+the cmake_policy command to set it to OLD or NEW explicitly.
diff --git a/Help/policy/CMP0045.rst b/Help/policy/CMP0045.rst
new file mode 100644
index 0000000..748eb6a
--- /dev/null
+++ b/Help/policy/CMP0045.rst
@@ -0,0 +1,17 @@
+CMP0045
+-------
+
+Error on non-existent target in get_target_property.
+
+In CMake 2.8.12 and lower, the :command:`get_target_property` command accepted
+a non-existent target argument without issuing any error or warning. The
+result variable is set to a ``-NOTFOUND`` value.
+
+The OLD behavior for this policy is to issue no warning and set the result
+variable to a ``-NOTFOUND`` value. The NEW behavior
+for this policy is to issue a ``FATAL_ERROR`` if the command is called with a
+non-existent target.
+
+This policy was introduced in CMake version 3.0.0. CMake version
+|release| warns when the policy is not set and uses OLD behavior. Use
+the cmake_policy command to set it to OLD or NEW explicitly.
diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake
index 46d3741..46a893d 100644
--- a/Modules/FindQt4.cmake
+++ b/Modules/FindQt4.cmake
@@ -1181,20 +1181,24 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
endmacro()
macro(_qt4_add_target_depends _QT_MODULE)
- get_target_property(_configs Qt4::${_QT_MODULE} IMPORTED_CONFIGURATIONS)
- _qt4_add_target_depends_internal(${_QT_MODULE} INTERFACE_LINK_LIBRARIES ${ARGN})
- foreach(_config ${_configs})
- _qt4_add_target_depends_internal(${_QT_MODULE} IMPORTED_LINK_INTERFACE_LIBRARIES_${_config} ${ARGN})
- endforeach()
- set(_configs)
+ if (TARGET Qt4::${_QT_MODULE})
+ get_target_property(_configs Qt4::${_QT_MODULE} IMPORTED_CONFIGURATIONS)
+ _qt4_add_target_depends_internal(${_QT_MODULE} INTERFACE_LINK_LIBRARIES ${ARGN})
+ foreach(_config ${_configs})
+ _qt4_add_target_depends_internal(${_QT_MODULE} IMPORTED_LINK_INTERFACE_LIBRARIES_${_config} ${ARGN})
+ endforeach()
+ set(_configs)
+ endif()
endmacro()
macro(_qt4_add_target_private_depends _QT_MODULE)
- get_target_property(_configs ${_QT_MODULE} IMPORTED_CONFIGURATIONS)
- foreach(_config ${_configs})
- _qt4_add_target_depends_internal(${_QT_MODULE} IMPORTED_LINK_DEPENDENT_LIBRARIES_${_config} ${ARGN})
- endforeach()
- set(_configs)
+ if (TARGET Qt4::${_QT_MODULE})
+ get_target_property(_configs Qt4::${_QT_MODULE} IMPORTED_CONFIGURATIONS)
+ foreach(_config ${_configs})
+ _qt4_add_target_depends_internal(${_QT_MODULE} IMPORTED_LINK_DEPENDENT_LIBRARIES_${_config} ${ARGN})
+ endforeach()
+ set(_configs)
+ endif()
endmacro()
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index 5edea86..1feb03a 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -412,10 +412,32 @@ struct CompilerIdNode : public cmGeneratorExpressionNode
return parameters.front().empty() ? "1" : "0";
}
- if (cmsysString_strcasecmp(parameters.begin()->c_str(), compilerId) == 0)
+ if (strcmp(parameters.begin()->c_str(), compilerId) == 0)
{
return "1";
}
+
+ if (cmsysString_strcasecmp(parameters.begin()->c_str(), compilerId) == 0)
+ {
+ switch(context->Makefile->GetPolicyStatus(cmPolicies::CMP0044))
+ {
+ case cmPolicies::WARN:
+ {
+ cmOStringStream e;
+ e << context->Makefile->GetPolicies()
+ ->GetPolicyWarning(cmPolicies::CMP0044);
+ context->Makefile->GetCMakeInstance()
+ ->IssueMessage(cmake::AUTHOR_WARNING,
+ e.str().c_str(), context->Backtrace);
+ }
+ case cmPolicies::OLD:
+ return "1";
+ case cmPolicies::NEW:
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::REQUIRED_IF_USED:
+ break;
+ }
+ }
return "0";
}
};
@@ -1024,7 +1046,12 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
/* else */ if (cmHasLiteralPrefix(propertyName.c_str(),
"COMPILE_DEFINITIONS_"))
{
- interfacePropertyName = "INTERFACE_COMPILE_DEFINITIONS";
+ cmPolicies::PolicyStatus polSt =
+ context->Makefile->GetPolicyStatus(cmPolicies::CMP0043);
+ if (polSt == cmPolicies::WARN || polSt == cmPolicies::OLD)
+ {
+ interfacePropertyName = "INTERFACE_COMPILE_DEFINITIONS";
+ }
}
#undef POPULATE_INTERFACE_PROPERTY_NAME
diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx
index 02f00a5..488cc28 100644
--- a/Source/cmGetTargetPropertyCommand.cxx
+++ b/Source/cmGetTargetPropertyCommand.cxx
@@ -40,7 +40,36 @@ bool cmGetTargetPropertyCommand
cmTarget& target = *tgt;
prop = target.GetProperty(args[2].c_str());
}
-
+ else
+ {
+ bool issueMessage = false;
+ cmOStringStream e;
+ cmake::MessageType messageType = cmake::AUTHOR_WARNING;
+ switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0045))
+ {
+ case cmPolicies::WARN:
+ issueMessage = true;
+ e << this->Makefile->GetPolicies()
+ ->GetPolicyWarning(cmPolicies::CMP0045) << "\n";
+ case cmPolicies::OLD:
+ break;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::NEW:
+ issueMessage = true;
+ messageType = cmake::FATAL_ERROR;
+ }
+ if (issueMessage)
+ {
+ e << "get_target_property() called with non-existent target \""
+ << targetName << "\".";
+ this->Makefile->IssueMessage(messageType, e.str().c_str());
+ if (messageType == cmake::FATAL_ERROR)
+ {
+ return false;
+ }
+ }
+ }
if (prop)
{
this->Makefile->AddDefinition(var.c_str(), prop);
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index b8c494f..1c4488f 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1334,9 +1334,6 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo()
const std::vector<cmValueWithOrigin> noconfig_compile_definitions =
mf->GetCompileDefinitionsEntries();
- std::vector<std::string> configs;
- mf->GetConfigurations(configs);
-
cmTargets& targets = mf->GetTargets();
for(cmTargets::iterator ti = targets.begin();
ti != targets.end(); ++ti)
@@ -1357,13 +1354,21 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo()
t->InsertCompileDefinition(*it);
}
- for(std::vector<std::string>::const_iterator ci = configs.begin();
- ci != configs.end(); ++ci)
+ cmPolicies::PolicyStatus polSt
+ = mf->GetPolicyStatus(cmPolicies::CMP0043);
+ if (polSt == cmPolicies::WARN || polSt == cmPolicies::OLD)
{
- std::string defPropName = "COMPILE_DEFINITIONS_";
- defPropName += cmSystemTools::UpperCase(*ci);
- t->AppendProperty(defPropName.c_str(),
- mf->GetProperty(defPropName.c_str()));
+ std::vector<std::string> configs;
+ mf->GetConfigurations(configs);
+
+ for(std::vector<std::string>::const_iterator ci = configs.begin();
+ ci != configs.end(); ++ci)
+ {
+ std::string defPropName = "COMPILE_DEFINITIONS_";
+ defPropName += cmSystemTools::UpperCase(*ci);
+ t->AppendProperty(defPropName.c_str(),
+ mf->GetProperty(defPropName.c_str()));
+ }
}
}
}
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 35b65b4..479e712 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1601,20 +1601,22 @@ void cmMakefile::InitializeFromParent()
}
// compile definitions property and per-config versions
- {
- this->SetProperty("COMPILE_DEFINITIONS",
- parent->GetProperty("COMPILE_DEFINITIONS"));
- std::vector<std::string> configs;
- this->GetConfigurations(configs);
- for(std::vector<std::string>::const_iterator ci = configs.begin();
- ci != configs.end(); ++ci)
- {
- std::string defPropName = "COMPILE_DEFINITIONS_";
- defPropName += cmSystemTools::UpperCase(*ci);
- this->SetProperty(defPropName.c_str(),
- parent->GetProperty(defPropName.c_str()));
+ cmPolicies::PolicyStatus polSt = this->GetPolicyStatus(cmPolicies::CMP0043);
+ if (polSt == cmPolicies::WARN || polSt == cmPolicies::OLD)
+ {
+ this->SetProperty("COMPILE_DEFINITIONS",
+ parent->GetProperty("COMPILE_DEFINITIONS"));
+ std::vector<std::string> configs;
+ this->GetConfigurations(configs);
+ for(std::vector<std::string>::const_iterator ci = configs.begin();
+ ci != configs.end(); ++ci)
+ {
+ std::string defPropName = "COMPILE_DEFINITIONS_";
+ defPropName += cmSystemTools::UpperCase(*ci);
+ const char* prop = parent->GetProperty(defPropName.c_str());
+ this->SetProperty(defPropName.c_str(), prop);
+ }
}
- }
// link libraries
this->LinkLibraries = parent->LinkLibraries;
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 987c663..5a189f8 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -316,6 +316,21 @@ cmPolicies::cmPolicies()
CMP0042, "CMP0042",
"MACOSX_RPATH is enabled by default.",
3,0,0,0, cmPolicies::WARN);
+
+ this->DefinePolicy(
+ CMP0043, "CMP0043",
+ "Ignore COMPILE_DEFINITIONS_<Config> properties.",
+ 3,0,0,0, cmPolicies::WARN);
+
+ this->DefinePolicy(
+ CMP0044, "CMP0044",
+ "Case sensitive <LANG>_COMPILER_ID generator expressions.",
+ 3,0,0,0, cmPolicies::WARN);
+
+ this->DefinePolicy(
+ CMP0045, "CMP0045",
+ "Error on non-existent target in get_target_property.",
+ 3,0,0,0, cmPolicies::WARN);
}
cmPolicies::~cmPolicies()
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 66eaf87..b1342bf 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -96,6 +96,9 @@ public:
/// add_custom_command() must exist.
CMP0041, ///< Error on relative include with generator expression
CMP0042, ///< Enable MACOSX_RPATH by default
+ CMP0043, ///< Ignore COMPILE_DEFINITIONS_<Config> properties
+ CMP0044, ///< Case sensitive <LANG>_COMPILER_ID generator expressions
+ CMP0045, ///< Error on non-existent target in get_target_property
/** \brief Always the last entry.
*
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index b06480b..a8468ef 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -2209,14 +2209,34 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
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));
+ if (configProp)
+ {
+ switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0043))
+ {
+ case cmPolicies::WARN:
+ {
+ cmOStringStream e;
+ e << this->Makefile->GetCMakeInstance()->GetPolicies()
+ ->GetPolicyWarning(cmPolicies::CMP0043);
+ this->Makefile->IssueMessage(cmake::AUTHOR_WARNING,
+ e.str().c_str());
+ }
+ case cmPolicies::OLD:
+ {
+ cmGeneratorExpression ge(lfbt);
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
+ ge.Parse(configProp);
+ this->Internal
+ ->CachedLinkInterfaceCompileDefinitionsEntries[configString]
+ .push_back(new cmTargetInternals::TargetPropertyEntry(cge));
+ }
+ break;
+ case cmPolicies::NEW:
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::REQUIRED_IF_USED:
+ break;
+ }
+ }
}
}
diff --git a/Tests/CompileDefinitions/compiletest.c b/Tests/CompileDefinitions/compiletest.c
index d7883af..8871750 100644
--- a/Tests/CompileDefinitions/compiletest.c
+++ b/Tests/CompileDefinitions/compiletest.c
@@ -13,6 +13,10 @@
#error Unexpected LINK_LANGUAGE_IS_CXX
#endif
+#ifdef DEBUG_MODE
+#error Unexpected DEBUG_MODE
+#endif
+
int main(void)
{
return 0;
diff --git a/Tests/CompileDefinitions/target_prop/CMakeLists.txt b/Tests/CompileDefinitions/target_prop/CMakeLists.txt
index a0d3f4e..2ca2869 100644
--- a/Tests/CompileDefinitions/target_prop/CMakeLists.txt
+++ b/Tests/CompileDefinitions/target_prop/CMakeLists.txt
@@ -35,6 +35,9 @@ set_property(TARGET target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS
add_executable(target_prop_c_executable ../compiletest.c)
+cmake_policy(SET CMP0043 NEW)
+set_property(TARGET target_prop_c_executable APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG DEBUG_MODE)
+
set_property(TARGET target_prop_c_executable APPEND PROPERTY COMPILE_DEFINITIONS
"$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,CXX>:LINK_CXX_DEFINE>"
"$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,C>:LINK_C_DEFINE>"
diff --git a/Tests/GeneratorExpression/CMP0044/CMakeLists.txt b/Tests/GeneratorExpression/CMP0044/CMakeLists.txt
new file mode 100644
index 0000000..309a8cc
--- /dev/null
+++ b/Tests/GeneratorExpression/CMP0044/CMakeLists.txt
@@ -0,0 +1,19 @@
+
+string(TOLOWER ${CMAKE_C_COMPILER_ID} lc_test)
+if (lc_test STREQUAL CMAKE_C_COMPILER_ID)
+ string(TOUPPER ${CMAKE_C_COMPILER_ID} lc_test)
+ if (lc_test STREQUAL CMAKE_C_COMPILER_ID)
+ message(SEND_ERROR "Try harder.")
+ endif()
+endif()
+
+if (CMP0044_TYPE)
+ cmake_policy(SET CMP0044 ${CMP0044_TYPE})
+endif()
+
+add_library(cmp0044-check-${CMP0044_TYPE} cmp0044-check.cpp)
+target_compile_definitions(cmp0044-check-${CMP0044_TYPE}
+ PRIVATE
+ Result=$<C_COMPILER_ID:${lc_test}>
+ Type_Is_${CMP0044_TYPE}
+)
diff --git a/Tests/GeneratorExpression/CMP0044/cmp0044-check.cpp b/Tests/GeneratorExpression/CMP0044/cmp0044-check.cpp
new file mode 100644
index 0000000..2356bc4
--- /dev/null
+++ b/Tests/GeneratorExpression/CMP0044/cmp0044-check.cpp
@@ -0,0 +1,26 @@
+
+#ifdef Type_Is_
+# if !Result
+# error Result should be 1 in WARN mode
+# endif
+#endif
+
+#ifdef Type_Is_NEW
+# if Result
+# error Result should be 0 in NEW mode
+# endif
+#endif
+
+#ifdef Type_Is_OLD
+# if !Result
+# error Result should be 1 in OLD mode
+# endif
+#endif
+
+#if !defined(Type_Is_) && !defined(Type_Is_OLD) && !defined(Type_Is_NEW)
+#error No expected definition present
+#endif
+
+void foo(void)
+{
+}
diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt
index 3b85dc3..a0e34ef 100644
--- a/Tests/GeneratorExpression/CMakeLists.txt
+++ b/Tests/GeneratorExpression/CMakeLists.txt
@@ -252,3 +252,9 @@ endforeach()
add_test(echo-old-style echo "\$<CONFIGURATION>")
set_property(TEST echo-old-style PROPERTY
PASS_REGULAR_EXPRESSION "^\\$<CONFIGURATION>\n$")
+
+add_subdirectory(CMP0044 ${CMAKE_BINARY_DIR}/CMP0044-WARN)
+set(CMP0044_TYPE NEW)
+add_subdirectory(CMP0044 ${CMAKE_BINARY_DIR}/CMP0044-NEW)
+set(CMP0044_TYPE OLD)
+add_subdirectory(CMP0044 ${CMAKE_BINARY_DIR}/CMP0044-OLD)
diff --git a/Tests/RunCMake/CMP0043/CMP0043-NEW-result.txt b/Tests/RunCMake/CMP0043/CMP0043-NEW-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CMP0043/CMP0043-NEW-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CMP0043/CMP0043-NEW-stderr.txt b/Tests/RunCMake/CMP0043/CMP0043-NEW-stderr.txt
new file mode 100644
index 0000000..10f3293
--- /dev/null
+++ b/Tests/RunCMake/CMP0043/CMP0043-NEW-stderr.txt
@@ -0,0 +1 @@
+^$
diff --git a/Tests/RunCMake/CMP0043/CMP0043-NEW.cmake b/Tests/RunCMake/CMP0043/CMP0043-NEW.cmake
new file mode 100644
index 0000000..857153d
--- /dev/null
+++ b/Tests/RunCMake/CMP0043/CMP0043-NEW.cmake
@@ -0,0 +1,7 @@
+
+cmake_policy(SET CMP0043 NEW)
+
+add_library(foo empty.cpp)
+set_property(TARGET foo
+ PROPERTY COMPILE_DEFINITIONS_DEBUG "DEBUG_MODE"
+)
diff --git a/Tests/RunCMake/CMP0043/CMP0043-OLD-result.txt b/Tests/RunCMake/CMP0043/CMP0043-OLD-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CMP0043/CMP0043-OLD-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CMP0043/CMP0043-OLD-stderr.txt b/Tests/RunCMake/CMP0043/CMP0043-OLD-stderr.txt
new file mode 100644
index 0000000..10f3293
--- /dev/null
+++ b/Tests/RunCMake/CMP0043/CMP0043-OLD-stderr.txt
@@ -0,0 +1 @@
+^$
diff --git a/Tests/RunCMake/CMP0043/CMP0043-OLD.cmake b/Tests/RunCMake/CMP0043/CMP0043-OLD.cmake
new file mode 100644
index 0000000..f379430
--- /dev/null
+++ b/Tests/RunCMake/CMP0043/CMP0043-OLD.cmake
@@ -0,0 +1,7 @@
+
+cmake_policy(SET CMP0043 OLD)
+
+add_library(foo empty.cpp)
+set_property(TARGET foo
+ PROPERTY COMPILE_DEFINITIONS_DEBUG "DEBUG_MODE"
+)
diff --git a/Tests/RunCMake/CMP0043/CMP0043-WARN-result.txt b/Tests/RunCMake/CMP0043/CMP0043-WARN-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CMP0043/CMP0043-WARN-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CMP0043/CMP0043-WARN-stderr.txt b/Tests/RunCMake/CMP0043/CMP0043-WARN-stderr.txt
new file mode 100644
index 0000000..4769a63
--- /dev/null
+++ b/Tests/RunCMake/CMP0043/CMP0043-WARN-stderr.txt
@@ -0,0 +1,5 @@
+CMake Warning \(dev\) in CMakeLists.txt:
+ Policy CMP0043 is not set: Ignore COMPILE_DEFINITIONS_<Config> properties.
+ Run "cmake --help-policy CMP0043" for policy details. Use the cmake_policy
+ command to set the policy and suppress this warning.
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CMP0043/CMP0043-WARN.cmake b/Tests/RunCMake/CMP0043/CMP0043-WARN.cmake
new file mode 100644
index 0000000..161a60d
--- /dev/null
+++ b/Tests/RunCMake/CMP0043/CMP0043-WARN.cmake
@@ -0,0 +1,5 @@
+
+add_library(foo empty.cpp)
+set_property(TARGET foo
+ PROPERTY COMPILE_DEFINITIONS_DEBUG "DEBUG_MODE"
+)
diff --git a/Tests/RunCMake/CMP0043/CMakeLists.txt b/Tests/RunCMake/CMP0043/CMakeLists.txt
new file mode 100644
index 0000000..b465c88
--- /dev/null
+++ b/Tests/RunCMake/CMP0043/CMakeLists.txt
@@ -0,0 +1,7 @@
+cmake_minimum_required(VERSION 2.8)
+project(${RunCMake_TEST} CXX)
+include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE)
+
+if(CMAKE_BUILD_TYPE)
+ # Dummy variable use
+endif()
diff --git a/Tests/RunCMake/CMP0043/RunCMakeTest.cmake b/Tests/RunCMake/CMP0043/RunCMakeTest.cmake
new file mode 100644
index 0000000..7f9572e
--- /dev/null
+++ b/Tests/RunCMake/CMP0043/RunCMakeTest.cmake
@@ -0,0 +1,7 @@
+include(RunCMake)
+
+list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug)
+
+run_cmake(CMP0043-OLD)
+run_cmake(CMP0043-NEW)
+run_cmake(CMP0043-WARN)
diff --git a/Tests/RunCMake/CMP0043/empty.cpp b/Tests/RunCMake/CMP0043/empty.cpp
new file mode 100644
index 0000000..bfbbdde
--- /dev/null
+++ b/Tests/RunCMake/CMP0043/empty.cpp
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+int empty()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CMP0045/CMP0045-NEW-result.txt b/Tests/RunCMake/CMP0045/CMP0045-NEW-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0045/CMP0045-NEW-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0045/CMP0045-NEW-stderr.txt b/Tests/RunCMake/CMP0045/CMP0045-NEW-stderr.txt
new file mode 100644
index 0000000..805a85e
--- /dev/null
+++ b/Tests/RunCMake/CMP0045/CMP0045-NEW-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at CMP0045-NEW.cmake:4 \(get_target_property\):
+ get_target_property\(\) called with non-existent target "tgt".
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/CMP0045/CMP0045-NEW.cmake b/Tests/RunCMake/CMP0045/CMP0045-NEW.cmake
new file mode 100644
index 0000000..7b2a3cd
--- /dev/null
+++ b/Tests/RunCMake/CMP0045/CMP0045-NEW.cmake
@@ -0,0 +1,4 @@
+
+cmake_policy(SET CMP0045 NEW)
+
+get_target_property(result tgt TYPE)
diff --git a/Tests/RunCMake/CMP0045/CMP0045-OLD-result.txt b/Tests/RunCMake/CMP0045/CMP0045-OLD-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CMP0045/CMP0045-OLD-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CMP0045/CMP0045-OLD-stderr.txt b/Tests/RunCMake/CMP0045/CMP0045-OLD-stderr.txt
new file mode 100644
index 0000000..10f3293
--- /dev/null
+++ b/Tests/RunCMake/CMP0045/CMP0045-OLD-stderr.txt
@@ -0,0 +1 @@
+^$
diff --git a/Tests/RunCMake/CMP0045/CMP0045-OLD.cmake b/Tests/RunCMake/CMP0045/CMP0045-OLD.cmake
new file mode 100644
index 0000000..90201a3
--- /dev/null
+++ b/Tests/RunCMake/CMP0045/CMP0045-OLD.cmake
@@ -0,0 +1,4 @@
+
+cmake_policy(SET CMP0045 OLD)
+
+get_target_property(result tgt TYPE)
diff --git a/Tests/RunCMake/CMP0045/CMP0045-WARN-result.txt b/Tests/RunCMake/CMP0045/CMP0045-WARN-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CMP0045/CMP0045-WARN-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CMP0045/CMP0045-WARN-stderr.txt b/Tests/RunCMake/CMP0045/CMP0045-WARN-stderr.txt
new file mode 100644
index 0000000..4c53224
--- /dev/null
+++ b/Tests/RunCMake/CMP0045/CMP0045-WARN-stderr.txt
@@ -0,0 +1,9 @@
+CMake Warning \(dev\) at CMP0045-WARN.cmake:2 \(get_target_property\):
+ Policy CMP0045 is not set: Error on non-existent target in
+ get_target_property. Run "cmake --help-policy CMP0045" for policy details.
+ Use the cmake_policy command to set the policy and suppress this warning.
+
+ get_target_property\(\) called with non-existent target "tgt".
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CMP0045/CMP0045-WARN.cmake b/Tests/RunCMake/CMP0045/CMP0045-WARN.cmake
new file mode 100644
index 0000000..86a99a0
--- /dev/null
+++ b/Tests/RunCMake/CMP0045/CMP0045-WARN.cmake
@@ -0,0 +1,2 @@
+
+get_target_property(result tgt TYPE)
diff --git a/Tests/RunCMake/CMP0045/CMakeLists.txt b/Tests/RunCMake/CMP0045/CMakeLists.txt
new file mode 100644
index 0000000..11ea636
--- /dev/null
+++ b/Tests/RunCMake/CMP0045/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8)
+project(${RunCMake_TEST} CXX)
+include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE)
diff --git a/Tests/RunCMake/CMP0045/RunCMakeTest.cmake b/Tests/RunCMake/CMP0045/RunCMakeTest.cmake
new file mode 100644
index 0000000..7c0e8a2
--- /dev/null
+++ b/Tests/RunCMake/CMP0045/RunCMakeTest.cmake
@@ -0,0 +1,5 @@
+include(RunCMake)
+
+run_cmake(CMP0045-OLD)
+run_cmake(CMP0045-NEW)
+run_cmake(CMP0045-WARN)
diff --git a/Tests/RunCMake/CMP0045/empty.cpp b/Tests/RunCMake/CMP0045/empty.cpp
new file mode 100644
index 0000000..bfbbdde
--- /dev/null
+++ b/Tests/RunCMake/CMP0045/empty.cpp
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+int empty()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 50c1f61..77700d7 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -64,6 +64,8 @@ add_RunCMake_test(CMP0041)
if(CMAKE_SYSTEM_NAME MATCHES Darwin AND CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG)
add_RunCMake_test(CMP0042)
endif()
+add_RunCMake_test(CMP0043)
+add_RunCMake_test(CMP0045)
add_RunCMake_test(CTest)
if(UNIX AND "${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles")
add_RunCMake_test(CompilerChange)
diff --git a/Tests/RunCMake/GeneratorExpression/CMP0044-WARN-result.txt b/Tests/RunCMake/GeneratorExpression/CMP0044-WARN-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/CMP0044-WARN-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/GeneratorExpression/CMP0044-WARN-stderr.txt b/Tests/RunCMake/GeneratorExpression/CMP0044-WARN-stderr.txt
new file mode 100644
index 0000000..2079c12
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/CMP0044-WARN-stderr.txt
@@ -0,0 +1,7 @@
+CMake Warning \(dev\) at CMP0044-WARN.cmake:13 \(target_compile_definitions\):
+ Policy CMP0044 is not set: Case sensitive <LANG>_COMPILER_ID generator
+ expressions. Run "cmake --help-policy CMP0044" for policy details. Use
+ the cmake_policy command to set the policy and suppress this warning.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/GeneratorExpression/CMP0044-WARN.cmake b/Tests/RunCMake/GeneratorExpression/CMP0044-WARN.cmake
new file mode 100644
index 0000000..d5b85c9
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/CMP0044-WARN.cmake
@@ -0,0 +1,17 @@
+
+project(CMP0044-WARN)
+
+string(TOLOWER ${CMAKE_C_COMPILER_ID} lc_test)
+if (lc_test STREQUAL CMAKE_C_COMPILER_ID)
+ string(TOUPPER ${CMAKE_C_COMPILER_ID} lc_test)
+ if (lc_test STREQUAL CMAKE_C_COMPILER_ID)
+ message(SEND_ERROR "Try harder.")
+ endif()
+endif()
+
+add_library(cmp0044-check empty.c)
+target_compile_definitions(cmp0044-check
+ PRIVATE
+ Result=$<C_COMPILER_ID:${lc_test}>
+ Type_Is_${CMP0044_TYPE}
+)
diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
index 54d5064..f3f99ed 100644
--- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
@@ -9,3 +9,4 @@ run_cmake(BadZero)
run_cmake(BadTargetName)
run_cmake(BadTargetTypeObject)
run_cmake(BadInstallPrefix)
+run_cmake(CMP0044-WARN)