diff options
author | Brad King <brad.king@kitware.com> | 2015-09-14 13:19:59 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-09-14 13:19:59 (GMT) |
commit | 31117bb17c4e764bb60b8c9c6847a631cc9ecf3c (patch) | |
tree | 7d5344a424d0993e66414739d24bd02d6749e449 | |
parent | 75ad8d342119be9e71006c2f352755ad9565963b (diff) | |
parent | ed258d606b87dacc465dad73b04f1c3e270b627c (diff) | |
download | CMake-31117bb17c4e764bb60b8c9c6847a631cc9ecf3c.zip CMake-31117bb17c4e764bb60b8c9c6847a631cc9ecf3c.tar.gz CMake-31117bb17c4e764bb60b8c9c6847a631cc9ecf3c.tar.bz2 |
Merge topic 'fix-buildsystem-property-append'
ed258d60 Tests: Cover set_property for buildsystem directory properties
fb45c371 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.
-rw-r--r-- | Source/cmState.cxx | 9 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 10 | ||||
-rw-r--r-- | Tests/RunCMake/set_property/COMPILE_DEFINITIONS-stdout.txt | 3 | ||||
-rw-r--r-- | Tests/RunCMake/set_property/COMPILE_DEFINITIONS.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/set_property/COMPILE_FEATURES-stdout.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/set_property/COMPILE_OPTIONS-stdout.txt | 3 | ||||
-rw-r--r-- | Tests/RunCMake/set_property/COMPILE_OPTIONS.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/set_property/Common.cmake | 14 | ||||
-rw-r--r-- | Tests/RunCMake/set_property/INCLUDE_DIRECTORIES-stdout.txt | 3 | ||||
-rw-r--r-- | Tests/RunCMake/set_property/INCLUDE_DIRECTORIES.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/set_property/LINK_LIBRARIES-stdout.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/set_property/USER_PROP-stdout.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/set_property/USER_PROP.cmake | 1 |
13 files changed, 39 insertions, 12 deletions
diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 63909ab..ce9ff32 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -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(); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 3425f34..2dfa19c 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -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); diff --git a/Tests/RunCMake/set_property/COMPILE_DEFINITIONS-stdout.txt b/Tests/RunCMake/set_property/COMPILE_DEFINITIONS-stdout.txt index b85f41d..dd5bae1 100644 --- a/Tests/RunCMake/set_property/COMPILE_DEFINITIONS-stdout.txt +++ b/Tests/RunCMake/set_property/COMPILE_DEFINITIONS-stdout.txt @@ -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' diff --git a/Tests/RunCMake/set_property/COMPILE_DEFINITIONS.cmake b/Tests/RunCMake/set_property/COMPILE_DEFINITIONS.cmake index ec07ce9..f0c63bf 100644 --- a/Tests/RunCMake/set_property/COMPILE_DEFINITIONS.cmake +++ b/Tests/RunCMake/set_property/COMPILE_DEFINITIONS.cmake @@ -1,2 +1,3 @@ include(Common.cmake) test_target_property(COMPILE_DEFINITIONS) +test_directory_property(COMPILE_DEFINITIONS) diff --git a/Tests/RunCMake/set_property/COMPILE_FEATURES-stdout.txt b/Tests/RunCMake/set_property/COMPILE_FEATURES-stdout.txt index 81ef170..bd5a992 100644 --- a/Tests/RunCMake/set_property/COMPILE_FEATURES-stdout.txt +++ b/Tests/RunCMake/set_property/COMPILE_FEATURES-stdout.txt @@ -1 +1 @@ --- Target COMPILE_FEATURES is 'a;;b;c;;d;;e' +-- Target COMPILE_FEATURES is 'a;b;c;d;;e' diff --git a/Tests/RunCMake/set_property/COMPILE_OPTIONS-stdout.txt b/Tests/RunCMake/set_property/COMPILE_OPTIONS-stdout.txt index f18451a..1a20501 100644 --- a/Tests/RunCMake/set_property/COMPILE_OPTIONS-stdout.txt +++ b/Tests/RunCMake/set_property/COMPILE_OPTIONS-stdout.txt @@ -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' diff --git a/Tests/RunCMake/set_property/COMPILE_OPTIONS.cmake b/Tests/RunCMake/set_property/COMPILE_OPTIONS.cmake index da20ec8..75f0535 100644 --- a/Tests/RunCMake/set_property/COMPILE_OPTIONS.cmake +++ b/Tests/RunCMake/set_property/COMPILE_OPTIONS.cmake @@ -1,2 +1,3 @@ include(Common.cmake) test_target_property(COMPILE_OPTIONS) +test_directory_property(COMPILE_OPTIONS) diff --git a/Tests/RunCMake/set_property/Common.cmake b/Tests/RunCMake/set_property/Common.cmake index b359487..9d5e4f4 100644 --- a/Tests/RunCMake/set_property/Common.cmake +++ b/Tests/RunCMake/set_property/Common.cmake @@ -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() diff --git a/Tests/RunCMake/set_property/INCLUDE_DIRECTORIES-stdout.txt b/Tests/RunCMake/set_property/INCLUDE_DIRECTORIES-stdout.txt index f9970ce..c957dd5 100644 --- a/Tests/RunCMake/set_property/INCLUDE_DIRECTORIES-stdout.txt +++ b/Tests/RunCMake/set_property/INCLUDE_DIRECTORIES-stdout.txt @@ -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' diff --git a/Tests/RunCMake/set_property/INCLUDE_DIRECTORIES.cmake b/Tests/RunCMake/set_property/INCLUDE_DIRECTORIES.cmake index 8f44aee..c9a9151 100644 --- a/Tests/RunCMake/set_property/INCLUDE_DIRECTORIES.cmake +++ b/Tests/RunCMake/set_property/INCLUDE_DIRECTORIES.cmake @@ -1,2 +1,3 @@ include(Common.cmake) test_target_property(INCLUDE_DIRECTORIES) +test_directory_property(INCLUDE_DIRECTORIES) diff --git a/Tests/RunCMake/set_property/LINK_LIBRARIES-stdout.txt b/Tests/RunCMake/set_property/LINK_LIBRARIES-stdout.txt index 1f7663b..9a3988e 100644 --- a/Tests/RunCMake/set_property/LINK_LIBRARIES-stdout.txt +++ b/Tests/RunCMake/set_property/LINK_LIBRARIES-stdout.txt @@ -1 +1 @@ --- Target LINK_LIBRARIES is 'a;;b;c;;d;;e' +-- Target LINK_LIBRARIES is 'a;b;c;d;;e' diff --git a/Tests/RunCMake/set_property/USER_PROP-stdout.txt b/Tests/RunCMake/set_property/USER_PROP-stdout.txt index eaf6e37..107cc87 100644 --- a/Tests/RunCMake/set_property/USER_PROP-stdout.txt +++ b/Tests/RunCMake/set_property/USER_PROP-stdout.txt @@ -1 +1,2 @@ -- Target USER_PROP is 'a;b;c;d;;e' +-- Directory USER_PROP is 'a;b;c;d;;e' diff --git a/Tests/RunCMake/set_property/USER_PROP.cmake b/Tests/RunCMake/set_property/USER_PROP.cmake index e1f88e1..aa0aa83 100644 --- a/Tests/RunCMake/set_property/USER_PROP.cmake +++ b/Tests/RunCMake/set_property/USER_PROP.cmake @@ -1,2 +1,3 @@ include(Common.cmake) test_target_property(USER_PROP) +test_directory_property(USER_PROP) |