Merge topic 'remove-DEFINITIONS-directory-property'
06f61c26
Do not treat DEFINITIONS as a built-in directory property
This commit is contained in:
commit
0983825057
|
@ -116,3 +116,4 @@ All Policies
|
||||||
/policy/CMP0056
|
/policy/CMP0056
|
||||||
/policy/CMP0057
|
/policy/CMP0057
|
||||||
/policy/CMP0058
|
/policy/CMP0058
|
||||||
|
/policy/CMP0059
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
CMP0059
|
||||||
|
-------
|
||||||
|
|
||||||
|
Don't treat ``DEFINITIONS`` as a built-in directory property.
|
||||||
|
|
||||||
|
CMake 3.3 and above no longer make a list of definitions available through
|
||||||
|
the :prop_dir:`DEFINITIONS` directory property. The
|
||||||
|
:prop_dir:`COMPILE_DEFINITIONS` directory property may be used instead.
|
||||||
|
|
||||||
|
The ``OLD`` behavior for this policy is to provide the list of flags given
|
||||||
|
so far to the :command:`add_definitions` command. The ``NEW`` behavior is
|
||||||
|
to behave as a normal user-defined directory property.
|
||||||
|
|
||||||
|
This policy was introduced in CMake version 3.3.
|
||||||
|
CMake version |release| warns when the policy is not set and uses
|
||||||
|
``OLD`` behavior. Use the :command:`cmake_policy` command to set
|
||||||
|
it to ``OLD`` or ``NEW`` explicitly.
|
|
@ -1,8 +1,13 @@
|
||||||
DEFINITIONS
|
DEFINITIONS
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
For CMake 2.4 compatibility only. Use COMPILE_DEFINITIONS instead.
|
For CMake 2.4 compatibility only. Use :prop_dir:`COMPILE_DEFINITIONS`
|
||||||
|
instead.
|
||||||
|
|
||||||
This read-only property specifies the list of flags given so far to
|
This read-only property specifies the list of flags given so far to
|
||||||
the add_definitions command. It is intended for debugging purposes.
|
the :command:`add_definitions` command. It is intended for debugging
|
||||||
Use the COMPILE_DEFINITIONS instead.
|
purposes. Use the :prop_dir:`COMPILE_DEFINITIONS` directory property
|
||||||
|
instead.
|
||||||
|
|
||||||
|
This built-in read-only property does not exist if policy
|
||||||
|
:policy:`CMP0059` is set to ``NEW``.
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
remove-DEFINITIONS-property
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
* The :command:`add_definitions()` command no longer causes a
|
||||||
|
:prop_dir:`DEFINITIONS` directory property to be populated. See policy
|
||||||
|
:policy:`CMP0059`.
|
|
@ -4209,8 +4209,19 @@ const char *cmMakefile::GetProperty(const std::string& prop,
|
||||||
}
|
}
|
||||||
else if (prop == "DEFINITIONS")
|
else if (prop == "DEFINITIONS")
|
||||||
{
|
{
|
||||||
|
switch(this->GetPolicyStatus(cmPolicies::CMP0059))
|
||||||
|
{
|
||||||
|
case cmPolicies::WARN:
|
||||||
|
this->IssueMessage(cmake::AUTHOR_WARNING, this->GetPolicies()->
|
||||||
|
GetPolicyWarning(cmPolicies::CMP0059));
|
||||||
|
case cmPolicies::OLD:
|
||||||
output += this->DefineFlagsOrig;
|
output += this->DefineFlagsOrig;
|
||||||
return output.c_str();
|
return output.c_str();
|
||||||
|
case cmPolicies::NEW:
|
||||||
|
case cmPolicies::REQUIRED_ALWAYS:
|
||||||
|
case cmPolicies::REQUIRED_IF_USED:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (prop == "LINK_DIRECTORIES")
|
else if (prop == "LINK_DIRECTORIES")
|
||||||
{
|
{
|
||||||
|
|
|
@ -385,6 +385,11 @@ cmPolicies::cmPolicies()
|
||||||
CMP0058, "CMP0058",
|
CMP0058, "CMP0058",
|
||||||
"Ninja requires custom command byproducts to be explicit.",
|
"Ninja requires custom command byproducts to be explicit.",
|
||||||
3,3,0, cmPolicies::WARN);
|
3,3,0, cmPolicies::WARN);
|
||||||
|
|
||||||
|
this->DefinePolicy(
|
||||||
|
CMP0059, "CMP0059",
|
||||||
|
"Do no treat DEFINITIONS as a built-in directory property.",
|
||||||
|
3,3,0, cmPolicies::WARN);
|
||||||
}
|
}
|
||||||
|
|
||||||
cmPolicies::~cmPolicies()
|
cmPolicies::~cmPolicies()
|
||||||
|
|
|
@ -116,6 +116,8 @@ public:
|
||||||
CMP0057, ///< Disallow multiple MAIN_DEPENDENCY specifications
|
CMP0057, ///< Disallow multiple MAIN_DEPENDENCY specifications
|
||||||
/// for the same file.
|
/// for the same file.
|
||||||
CMP0058, ///< Ninja requires custom command byproducts to be explicit
|
CMP0058, ///< Ninja requires custom command byproducts to be explicit
|
||||||
|
CMP0059, ///< Do not treat ``DEFINITIONS`` as a built-in directory
|
||||||
|
/// property.
|
||||||
|
|
||||||
/** \brief Always the last entry.
|
/** \brief Always the last entry.
|
||||||
*
|
*
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
0
|
|
@ -0,0 +1,2 @@
|
||||||
|
DEFS:
|
||||||
|
CUSTOM CONTENT:CUSTOM_CONTENT
|
|
@ -0,0 +1,17 @@
|
||||||
|
|
||||||
|
cmake_policy(SET CMP0059 NEW)
|
||||||
|
|
||||||
|
add_definitions(-DSOME_DEF)
|
||||||
|
|
||||||
|
get_property(defs DIRECTORY .
|
||||||
|
PROPERTY DEFINITIONS
|
||||||
|
)
|
||||||
|
message("DEFS:${defs}")
|
||||||
|
|
||||||
|
set_property(DIRECTORY .
|
||||||
|
PROPERTY DEFINITIONS CUSTOM_CONTENT
|
||||||
|
)
|
||||||
|
get_property(content DIRECTORY .
|
||||||
|
PROPERTY DEFINITIONS
|
||||||
|
)
|
||||||
|
message("CUSTOM CONTENT:${content}")
|
|
@ -0,0 +1 @@
|
||||||
|
0
|
|
@ -0,0 +1,2 @@
|
||||||
|
DEFS: -DSOME_DEF
|
||||||
|
CUSTOM CONTENT: -DSOME_DEF
|
|
@ -0,0 +1,17 @@
|
||||||
|
|
||||||
|
cmake_policy(SET CMP0059 OLD)
|
||||||
|
|
||||||
|
add_definitions(-DSOME_DEF)
|
||||||
|
|
||||||
|
get_property(defs DIRECTORY .
|
||||||
|
PROPERTY DEFINITIONS
|
||||||
|
)
|
||||||
|
message("DEFS:${defs}")
|
||||||
|
|
||||||
|
set_property(DIRECTORY .
|
||||||
|
PROPERTY DEFINITIONS CUSTOM_CONTENT
|
||||||
|
)
|
||||||
|
get_property(content DIRECTORY .
|
||||||
|
PROPERTY DEFINITIONS
|
||||||
|
)
|
||||||
|
message("CUSTOM CONTENT:${content}")
|
|
@ -0,0 +1 @@
|
||||||
|
0
|
|
@ -0,0 +1,18 @@
|
||||||
|
CMake Warning \(dev\) at CMP0059-WARN.cmake:6 \(get_property\):
|
||||||
|
Policy CMP0059 is not set: Do no treat DEFINITIONS as a built-in directory
|
||||||
|
property. Run "cmake --help-policy CMP0059" 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.
|
||||||
|
|
||||||
|
DEFS: -DSOME_DEF
|
||||||
|
CMake Warning \(dev\) at CMP0059-WARN.cmake:14 \(get_property\):
|
||||||
|
Policy CMP0059 is not set: Do no treat DEFINITIONS as a built-in directory
|
||||||
|
property. Run "cmake --help-policy CMP0059" 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.
|
||||||
|
|
||||||
|
CUSTOM CONTENT: -DSOME_DEF
|
|
@ -0,0 +1,17 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
add_definitions(-DSOME_DEF)
|
||||||
|
|
||||||
|
get_property(defs DIRECTORY .
|
||||||
|
PROPERTY DEFINITIONS
|
||||||
|
)
|
||||||
|
message("DEFS:${defs}")
|
||||||
|
|
||||||
|
set_property(DIRECTORY .
|
||||||
|
PROPERTY DEFINITIONS CUSTOM_CONTENT
|
||||||
|
)
|
||||||
|
get_property(content DIRECTORY .
|
||||||
|
PROPERTY DEFINITIONS
|
||||||
|
)
|
||||||
|
message("CUSTOM CONTENT:${content}")
|
|
@ -0,0 +1,3 @@
|
||||||
|
cmake_minimum_required(VERSION 3.1)
|
||||||
|
project(${RunCMake_TEST} NONE)
|
||||||
|
include(${RunCMake_TEST}.cmake)
|
|
@ -0,0 +1,5 @@
|
||||||
|
include(RunCMake)
|
||||||
|
|
||||||
|
run_cmake(CMP0059-OLD)
|
||||||
|
run_cmake(CMP0059-NEW)
|
||||||
|
run_cmake(CMP0059-WARN)
|
|
@ -64,6 +64,7 @@ add_RunCMake_test(CMP0053)
|
||||||
add_RunCMake_test(CMP0054)
|
add_RunCMake_test(CMP0054)
|
||||||
add_RunCMake_test(CMP0055)
|
add_RunCMake_test(CMP0055)
|
||||||
add_RunCMake_test(CMP0057)
|
add_RunCMake_test(CMP0057)
|
||||||
|
add_RunCMake_test(CMP0059)
|
||||||
if(CMAKE_GENERATOR STREQUAL "Ninja")
|
if(CMAKE_GENERATOR STREQUAL "Ninja")
|
||||||
add_RunCMake_test(Ninja)
|
add_RunCMake_test(Ninja)
|
||||||
endif()
|
endif()
|
||||||
|
|
Loading…
Reference in New Issue