Merge topic 'fix-buildsystem-property-append'
ed258d60
Tests: Cover set_property for buildsystem directory propertiesfb45c371
cmState: Only append non-empty values to buildsystem properties.158f7e31
cmMakefile: Use appropriate parameter name.08ce3f48
cmTarget: Only append non-empty values to buildsystem properties.
This commit is contained in:
commit
31117bb17c
|
@ -1377,11 +1377,16 @@ cmBacktraceRange GetPropertyBacktraces(T const& content,
|
|||
|
||||
template <typename T, typename U, typename V>
|
||||
void AppendEntry(T& content, U& backtraces, V& endContentPosition,
|
||||
const std::string& vec, const cmListFileBacktrace& lfbt)
|
||||
const std::string& value, const cmListFileBacktrace& lfbt)
|
||||
{
|
||||
if (value.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
assert(endContentPosition == content.size());
|
||||
|
||||
content.push_back(vec);
|
||||
content.push_back(value);
|
||||
backtraces.push_back(lfbt);
|
||||
|
||||
endContentPosition = content.size();
|
||||
|
|
|
@ -1706,7 +1706,7 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
|
|||
}
|
||||
else if(prop == "INCLUDE_DIRECTORIES")
|
||||
{
|
||||
if (value)
|
||||
if (value && *value)
|
||||
{
|
||||
this->Internal->IncludeDirectoriesEntries.push_back(value);
|
||||
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
||||
|
@ -1715,7 +1715,7 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
|
|||
}
|
||||
else if(prop == "COMPILE_OPTIONS")
|
||||
{
|
||||
if (value)
|
||||
if (value && *value)
|
||||
{
|
||||
this->Internal->CompileOptionsEntries.push_back(value);
|
||||
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
||||
|
@ -1724,7 +1724,7 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
|
|||
}
|
||||
else if(prop == "COMPILE_FEATURES")
|
||||
{
|
||||
if (value)
|
||||
if (value && *value)
|
||||
{
|
||||
this->Internal->CompileFeaturesEntries.push_back(value);
|
||||
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
||||
|
@ -1733,7 +1733,7 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
|
|||
}
|
||||
else if(prop == "COMPILE_DEFINITIONS")
|
||||
{
|
||||
if (value)
|
||||
if (value && *value)
|
||||
{
|
||||
this->Internal->CompileDefinitionsEntries.push_back(value);
|
||||
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
||||
|
@ -1749,7 +1749,7 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
|
|||
}
|
||||
else if (prop == "LINK_LIBRARIES")
|
||||
{
|
||||
if (value)
|
||||
if (value && *value)
|
||||
{
|
||||
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
||||
cmValueWithOrigin entry(value, lfbt);
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
-- Target COMPILE_DEFINITIONS is 'a;;b;c;;d;;e'
|
||||
-- Target COMPILE_DEFINITIONS is 'a;b;c;d;;e'
|
||||
-- Directory COMPILE_DEFINITIONS is 'a;b;c;d;;e'
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
include(Common.cmake)
|
||||
test_target_property(COMPILE_DEFINITIONS)
|
||||
test_directory_property(COMPILE_DEFINITIONS)
|
||||
|
|
|
@ -1 +1 @@
|
|||
-- Target COMPILE_FEATURES is 'a;;b;c;;d;;e'
|
||||
-- Target COMPILE_FEATURES is 'a;b;c;d;;e'
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
-- Target COMPILE_OPTIONS is 'a;;b;c;;d;;e'
|
||||
-- Target COMPILE_OPTIONS is 'a;b;c;d;;e'
|
||||
-- Directory COMPILE_OPTIONS is 'a;b;c;d;;e'
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
include(Common.cmake)
|
||||
test_target_property(COMPILE_OPTIONS)
|
||||
test_directory_property(COMPILE_OPTIONS)
|
||||
|
|
|
@ -12,3 +12,17 @@ macro(test_target_property PROP)
|
|||
message(STATUS "Target ${PROP} is '${val}'")
|
||||
set_property(TARGET CustomTarget PROPERTY ${PROP})
|
||||
endmacro()
|
||||
|
||||
macro(test_directory_property PROP)
|
||||
set_property(DIRECTORY PROPERTY ${PROP} x)
|
||||
set_property(DIRECTORY PROPERTY ${PROP})
|
||||
set_property(DIRECTORY APPEND PROPERTY ${PROP})
|
||||
set_property(DIRECTORY PROPERTY ${PROP} a)
|
||||
set_property(DIRECTORY APPEND PROPERTY ${PROP} "")
|
||||
set_property(DIRECTORY APPEND PROPERTY ${PROP} b c)
|
||||
set_property(DIRECTORY APPEND PROPERTY ${PROP})
|
||||
set_property(DIRECTORY APPEND PROPERTY ${PROP} "d;;e")
|
||||
get_property(val DIRECTORY PROPERTY ${PROP})
|
||||
message(STATUS "Directory ${PROP} is '${val}'")
|
||||
set_property(DIRECTORY PROPERTY ${PROP})
|
||||
endmacro()
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
-- Target INCLUDE_DIRECTORIES is 'a;;b;c;;d;;e'
|
||||
-- Target INCLUDE_DIRECTORIES is 'a;b;c;d;;e'
|
||||
-- Directory INCLUDE_DIRECTORIES is 'a;b;c;d;;e'
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
include(Common.cmake)
|
||||
test_target_property(INCLUDE_DIRECTORIES)
|
||||
test_directory_property(INCLUDE_DIRECTORIES)
|
||||
|
|
|
@ -1 +1 @@
|
|||
-- Target LINK_LIBRARIES is 'a;;b;c;;d;;e'
|
||||
-- Target LINK_LIBRARIES is 'a;b;c;d;;e'
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
-- Target USER_PROP is 'a;b;c;d;;e'
|
||||
-- Directory USER_PROP is 'a;b;c;d;;e'
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
include(Common.cmake)
|
||||
test_target_property(USER_PROP)
|
||||
test_directory_property(USER_PROP)
|
||||
|
|
Loading…
Reference in New Issue