summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/manual/cmake-properties.7.rst2
-rw-r--r--Help/prop_tgt/BINARY_DIR.rst6
-rw-r--r--Help/prop_tgt/SOURCE_DIR.rst6
-rw-r--r--Help/release/dev/target-directory-properties.rst5
-rw-r--r--Modules/Compiler/MSVC-CXX-FeatureTests.cmake10
-rw-r--r--Modules/FindBZip2.cmake6
-rw-r--r--Modules/Platform/Darwin-AppleClang-C.cmake5
-rw-r--r--Modules/Platform/Darwin-AppleClang-CXX.cmake5
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmAlgorithms.h84
-rw-r--r--Source/cmCMakePolicyCommand.cxx16
-rw-r--r--Source/cmExportCommand.cxx6
-rw-r--r--Source/cmFileCommand.cxx2
-rw-r--r--Source/cmFindBase.cxx4
-rw-r--r--Source/cmFunctionCommand.cxx2
-rw-r--r--Source/cmGlobalGenerator.cxx12
-rw-r--r--Source/cmListCommand.cxx12
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx2
-rw-r--r--Source/cmMacroCommand.cxx2
-rw-r--r--Source/cmMakefile.cxx208
-rw-r--r--Source/cmMakefile.h25
-rw-r--r--Source/cmMessageCommand.cxx2
-rw-r--r--Source/cmOutputConverter.cxx2
-rw-r--r--Source/cmPolicies.cxx32
-rw-r--r--Source/cmPolicies.h4
-rw-r--r--Source/cmSetCommand.cxx2
-rw-r--r--Source/cmState.cxx312
-rw-r--r--Source/cmState.h32
-rw-r--r--Source/cmStringCommand.cxx12
-rw-r--r--Source/cmTarget.cxx65
-rw-r--r--Source/cmTarget.h11
-rw-r--r--Source/cmTargetCompileOptionsCommand.cxx3
-rw-r--r--Source/cmTargetIncludeDirectoriesCommand.cxx3
-rw-r--r--Source/cmcmd.cxx9
-rw-r--r--Tests/BuildDepends/CMakeLists.txt19
-rw-r--r--Tests/BuildDepends/Project/CMakeLists.txt12
-rw-r--r--Tests/BuildDepends/Project/object_depends.cxx1
-rw-r--r--Tests/BuildDepends/Project/object_depends_check.cmake7
-rw-r--r--Tests/CompileFeatures/CMakeLists.txt6
-rw-r--r--Tests/RunCMake/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/CompileDefinitions/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/CompileDefinitions/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/CompileDefinitions/SetEmpty-result.txt1
-rw-r--r--Tests/RunCMake/CompileDefinitions/SetEmpty-stderr.txt3
-rw-r--r--Tests/RunCMake/CompileDefinitions/SetEmpty.cmake12
-rw-r--r--Tests/RunCMake/export/AppendExport-stderr.txt2
-rw-r--r--Tests/RunCMake/export/AppendExport.cmake1
-rw-r--r--Tests/RunCMake/export/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/export/CustomTarget-result.txt1
-rw-r--r--Tests/RunCMake/export/CustomTarget-stderr.txt4
-rw-r--r--Tests/RunCMake/export/CustomTarget.cmake2
-rw-r--r--Tests/RunCMake/export/OldIface-stderr.txt2
-rw-r--r--Tests/RunCMake/export/OldIface.cmake1
-rw-r--r--Tests/RunCMake/export/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/get_property/target_properties-stderr.txt6
-rw-r--r--Tests/RunCMake/get_property/target_properties.cmake2
-rw-r--r--Utilities/Release/create-cmake-release.cmake1
-rw-r--r--Utilities/Release/ibm_aix_release.cmake15
58 files changed, 726 insertions, 293 deletions
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index 1d27a64..ac893c2 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -114,6 +114,7 @@ Properties on Targets
/prop_tgt/AUTOUIC_OPTIONS
/prop_tgt/AUTORCC
/prop_tgt/AUTORCC_OPTIONS
+ /prop_tgt/BINARY_DIR
/prop_tgt/BUILD_WITH_INSTALL_RPATH
/prop_tgt/BUNDLE_EXTENSION
/prop_tgt/BUNDLE
@@ -244,6 +245,7 @@ Properties on Targets
/prop_tgt/RUNTIME_OUTPUT_NAME_CONFIG
/prop_tgt/RUNTIME_OUTPUT_NAME
/prop_tgt/SKIP_BUILD_RPATH
+ /prop_tgt/SOURCE_DIR
/prop_tgt/SOURCES
/prop_tgt/SOVERSION
/prop_tgt/STATIC_LIBRARY_FLAGS_CONFIG
diff --git a/Help/prop_tgt/BINARY_DIR.rst b/Help/prop_tgt/BINARY_DIR.rst
new file mode 100644
index 0000000..246f7e6
--- /dev/null
+++ b/Help/prop_tgt/BINARY_DIR.rst
@@ -0,0 +1,6 @@
+BINARY_DIR
+----------
+
+This read-only property reports the value of the
+:variable:`CMAKE_CURRENT_BINARY_DIR` variable in the directory in which
+the target was defined.
diff --git a/Help/prop_tgt/SOURCE_DIR.rst b/Help/prop_tgt/SOURCE_DIR.rst
new file mode 100644
index 0000000..b25813b
--- /dev/null
+++ b/Help/prop_tgt/SOURCE_DIR.rst
@@ -0,0 +1,6 @@
+SOURCE_DIR
+----------
+
+This read-only property reports the value of the
+:variable:`CMAKE_CURRENT_SOURCE_DIR` variable in the directory in which
+the target was defined.
diff --git a/Help/release/dev/target-directory-properties.rst b/Help/release/dev/target-directory-properties.rst
new file mode 100644
index 0000000..5ab2938
--- /dev/null
+++ b/Help/release/dev/target-directory-properties.rst
@@ -0,0 +1,5 @@
+target-directory-properties
+---------------------------
+
+* The :prop_tgt:`SOURCE_DIR` and :prop_tgt:`BINARY_DIR` target properties
+ were introduced to allow project code to query where a target is defined.
diff --git a/Modules/Compiler/MSVC-CXX-FeatureTests.cmake b/Modules/Compiler/MSVC-CXX-FeatureTests.cmake
index fcedf3c..ad1d14b 100644
--- a/Modules/Compiler/MSVC-CXX-FeatureTests.cmake
+++ b/Modules/Compiler/MSVC-CXX-FeatureTests.cmake
@@ -3,6 +3,8 @@
# http://blogs.msdn.com/b/vcblog/archive/2013/06/28/c-11-14-stl-features-fixes-and-breaking-changes-in-vs-2013.aspx
# http://blogs.msdn.com/b/vcblog/archive/2014/11/17/c-11-14-17-features-in-vs-2015-preview.aspx
# http://www.visualstudio.com/en-us/news/vs2015-preview-vs.aspx
+# http://blogs.msdn.com/b/vcblog/archive/2015/04/29/c-11-14-17-features-in-vs-2015-rc.aspx
+# http://blogs.msdn.com/b/vcblog/archive/2015/06/19/c-11-14-17-features-in-vs-2015-rtm.aspx
set(_cmake_oldestSupported "_MSC_VER >= 1600")
@@ -10,10 +12,11 @@ set(_cmake_oldestSupported "_MSC_VER >= 1600")
set(MSVC_2015 "_MSC_VER >= 1900")
set(_cmake_feature_test_cxx_alignas "${MSVC_2015}")
set(_cmake_feature_test_cxx_alignof "${MSVC_2015}")
+set(_cmake_feature_test_cxx_attributes "${MSVC_2015}")
+set(_cmake_feature_test_cxx_attribute_deprecated "${MSVC_2015}")
set(_cmake_feature_test_cxx_binary_literals "${MSVC_2015}")
+set(_cmake_feature_test_cxx_constexpr "${MSVC_2015}")
set(_cmake_feature_test_cxx_decltype_auto "${MSVC_2015}")
-# Digit separators are not available as of VS 2015 Preview, but a footnote
-# says they will be available in the RTM.
set(_cmake_feature_test_cxx_digit_separators "${MSVC_2015}")
set(_cmake_feature_test_cxx_func_identifier "${MSVC_2015}")
set(_cmake_feature_test_cxx_nonstatic_member_init "${MSVC_2015}")
@@ -89,10 +92,7 @@ set(_cmake_feature_test_cxx_trailing_return_types "${MSVC_2010}")
set(_cmake_feature_test_cxx_variadic_macros "${MSVC_2010}")
# Currently unsupported:
-# set(_cmake_feature_test_cxx_constexpr )
# set(_cmake_feature_test_cxx_relaxed_constexpr )
-# set(_cmake_feature_test_cxx_attributes )
-# set(_cmake_feature_test_cxx_attribute_deprecated )
# 'NSDMIs for aggregates'
# set(_cmake_feature_test_cxx_aggregate_default_initializers )
# set(_cmake_feature_test_cxx_variable_templates )
diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake
index b479332..6af42dd 100644
--- a/Modules/FindBZip2.cmake
+++ b/Modules/FindBZip2.cmake
@@ -56,11 +56,13 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(BZip2
VERSION_VAR BZIP2_VERSION_STRING)
if (BZIP2_FOUND)
- include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake)
+ include(${CMAKE_CURRENT_LIST_DIR}/CheckSymbolExists.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
cmake_push_check_state()
set(CMAKE_REQUIRED_QUIET ${BZip2_FIND_QUIETLY})
- CHECK_LIBRARY_EXISTS("${BZIP2_LIBRARIES}" BZ2_bzCompressInit "" BZIP2_NEED_PREFIX)
+ set(CMAKE_REQUIRED_INCLUDES ${BZIP2_INCLUDE_DIR})
+ set(CMAKE_REQUIRED_LIBRARIES ${BZIP2_LIBRARIES})
+ CHECK_SYMBOL_EXISTS(BZ2_bzCompressInit "bzlib.h" BZIP2_NEED_PREFIX)
cmake_pop_check_state()
endif ()
diff --git a/Modules/Platform/Darwin-AppleClang-C.cmake b/Modules/Platform/Darwin-AppleClang-C.cmake
index 98971bb..3216b29 100644
--- a/Modules/Platform/Darwin-AppleClang-C.cmake
+++ b/Modules/Platform/Darwin-AppleClang-C.cmake
@@ -1 +1,6 @@
include(Platform/Darwin-Clang-C)
+if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.2)
+ set(CMAKE_C_SYSTEM_FRAMEWORK_SEARCH_FLAG "-iframework ")
+else()
+ unset(CMAKE_C_SYSTEM_FRAMEWORK_SEARCH_FLAG)
+endif()
diff --git a/Modules/Platform/Darwin-AppleClang-CXX.cmake b/Modules/Platform/Darwin-AppleClang-CXX.cmake
index 4e9e7c1..3fedf8c 100644
--- a/Modules/Platform/Darwin-AppleClang-CXX.cmake
+++ b/Modules/Platform/Darwin-AppleClang-CXX.cmake
@@ -1 +1,6 @@
include(Platform/Darwin-Clang-CXX)
+if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.2)
+ set(CMAKE_CXX_SYSTEM_FRAMEWORK_SEARCH_FLAG "-iframework ")
+else()
+ unset(CMAKE_CXX_SYSTEM_FRAMEWORK_SEARCH_FLAG)
+endif()
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index ebceff9..f5c693a 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 3)
-set(CMake_VERSION_PATCH 20150721)
+set(CMake_VERSION_PATCH 20150727)
#set(CMake_VERSION_RC 1)
diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h
index f117475..bda933b 100644
--- a/Source/cmAlgorithms.h
+++ b/Source/cmAlgorithms.h
@@ -122,35 +122,6 @@ struct DefaultDeleter<Range, /* valueTypeIsPair = */ true>
}
};
-template<typename const_iterator_>
-struct Range
-{
- typedef const_iterator_ const_iterator;
- typedef typename std::iterator_traits<const_iterator>::value_type value_type;
- typedef typename std::iterator_traits<const_iterator>::difference_type
- difference_type;
- Range(const_iterator begin_, const_iterator end_)
- : Begin(begin_), End(end_) {}
- const_iterator begin() const { return Begin; }
- const_iterator end() const { return End; }
- bool empty() const { return std::distance(Begin, End) == 0; }
- difference_type size() const { return std::distance(Begin, End); }
- Range& advance(cmIML_INT_intptr_t amount)
- {
- std::advance(Begin, amount);
- return *this;
- }
-
- Range& retreat(cmIML_INT_intptr_t amount)
- {
- std::advance(End, -amount);
- return *this;
- }
-private:
- const_iterator Begin;
- const_iterator End;
-};
-
template<typename FwdIt>
FwdIt RemoveN(FwdIt i1, FwdIt i2, size_t n)
{
@@ -178,17 +149,52 @@ private:
}
+template<typename const_iterator_>
+struct cmRange
+{
+ typedef const_iterator_ const_iterator;
+ typedef typename std::iterator_traits<const_iterator>::value_type value_type;
+ typedef typename std::iterator_traits<const_iterator>::difference_type
+ difference_type;
+ cmRange(const_iterator begin_, const_iterator end_)
+ : Begin(begin_), End(end_) {}
+ const_iterator begin() const { return Begin; }
+ const_iterator end() const { return End; }
+ bool empty() const { return std::distance(Begin, End) == 0; }
+ difference_type size() const { return std::distance(Begin, End); }
+ cmRange& advance(cmIML_INT_intptr_t amount)
+ {
+ std::advance(Begin, amount);
+ return *this;
+ }
+
+ cmRange& retreat(cmIML_INT_intptr_t amount)
+ {
+ std::advance(End, -amount);
+ return *this;
+ }
+private:
+ const_iterator Begin;
+ const_iterator End;
+};
+
+typedef cmRange<std::vector<std::string>::const_iterator> cmStringRange;
+
+class cmListFileBacktrace;
+typedef
+cmRange<std::vector<cmListFileBacktrace>::const_iterator> cmBacktraceRange;
+
template<typename Iter1, typename Iter2>
-ContainerAlgorithms::Range<Iter1> cmRange(Iter1 begin, Iter2 end)
+cmRange<Iter1> cmMakeRange(Iter1 begin, Iter2 end)
{
- return ContainerAlgorithms::Range<Iter1>(begin, end);
+ return cmRange<Iter1>(begin, end);
}
template<typename Range>
-ContainerAlgorithms::Range<typename Range::const_iterator>
-cmRange(Range const& range)
+cmRange<typename Range::const_iterator>
+cmMakeRange(Range const& range)
{
- return ContainerAlgorithms::Range<typename Range::const_iterator>(
+ return cmRange<typename Range::const_iterator>(
range.begin(), range.end());
}
@@ -350,11 +356,17 @@ typename Range::const_iterator cmFindNot(Range const& r, T const& t)
}
template<typename Range>
-ContainerAlgorithms::Range<typename Range::const_reverse_iterator>
+cmRange<typename Range::const_reverse_iterator>
cmReverseRange(Range const& range)
{
- return ContainerAlgorithms::Range<typename Range::const_reverse_iterator>(
+ return cmRange<typename Range::const_reverse_iterator>(
range.rbegin(), range.rend());
}
+template <class Iter>
+std::reverse_iterator<Iter> cmMakeReverseIterator(Iter it)
+{
+ return std::reverse_iterator<Iter>(it);
+}
+
#endif
diff --git a/Source/cmCMakePolicyCommand.cxx b/Source/cmCMakePolicyCommand.cxx
index 3c878bf..3ef6d35 100644
--- a/Source/cmCMakePolicyCommand.cxx
+++ b/Source/cmCMakePolicyCommand.cxx
@@ -93,6 +93,22 @@ bool cmCMakePolicyCommand::HandleSetMode(std::vector<std::string> const& args)
this->SetError("SET failed to set policy.");
return false;
}
+ if(args[1] == "CMP0001" &&
+ (status == cmPolicies::WARN || status == cmPolicies::OLD))
+ {
+ if(!(this->Makefile->GetState()
+ ->GetInitializedCacheValue("CMAKE_BACKWARDS_COMPATIBILITY")))
+ {
+ // Set it to 2.4 because that is the last version where the
+ // variable had meaning.
+ this->Makefile->AddCacheDefinition
+ ("CMAKE_BACKWARDS_COMPATIBILITY", "2.4",
+ "For backwards compatibility, what version of CMake "
+ "commands and "
+ "syntax should this version of CMake try to support.",
+ cmState::STRING);
+ }
+ }
return true;
}
diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx
index 43d26f9..96ea77b 100644
--- a/Source/cmExportCommand.cxx
+++ b/Source/cmExportCommand.cxx
@@ -177,6 +177,12 @@ bool cmExportCommand
this->SetError(e.str());
return false;
}
+ if (target->GetType() == cmTarget::UTILITY)
+ {
+ this->SetError("given custom target \"" + *currentTarget
+ + "\" which may not be exported.");
+ return false;
+ }
}
else
{
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 3d84f38..0daed66 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -270,7 +270,7 @@ bool cmFileCommand::HandleWriteCommand(std::vector<std::string> const& args,
this->SetError(error);
return false;
}
- std::string message = cmJoin(cmRange(i, args.end()), std::string());
+ std::string message = cmJoin(cmMakeRange(i, args.end()), std::string());
file << message;
file.close();
if(mode)
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index add06a7..7959ffe 100644
--- a/Source/cmFindBase.cxx
+++ b/Source/cmFindBase.cxx
@@ -170,8 +170,8 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn)
else
{
this->VariableDocumentation += "one of the ";
- this->VariableDocumentation += cmJoin(cmRange(this->Names).retreat(1),
- ", ");
+ this->VariableDocumentation +=
+ cmJoin(cmMakeRange(this->Names).retreat(1), ", ");
this->VariableDocumentation += " or "
+ this->Names[this->Names.size() - 1] + " libraries be found";
}
diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx
index 78853ce..c883ad7 100644
--- a/Source/cmFunctionCommand.cxx
+++ b/Source/cmFunctionCommand.cxx
@@ -125,7 +125,7 @@ bool cmFunctionHelperCommand::InvokeInitialPass
std::string argvDef = cmJoin(expandedArgs, ";");
std::vector<std::string>::const_iterator eit
= expandedArgs.begin() + (this->Args.size()-1);
- std::string argnDef = cmJoin(cmRange(eit, expandedArgs.end()), ";");
+ std::string argnDef = cmJoin(cmMakeRange(eit, expandedArgs.end()), ";");
this->Makefile->AddDefinition("ARGV", argvDef.c_str());
this->Makefile->MarkVariableAsUsed("ARGV");
this->Makefile->AddDefinition("ARGN", argnDef.c_str());
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 88ac0bc..40a8586 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1417,8 +1417,10 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo()
{
cmMakefile *mf = this->LocalGenerators[i]->GetMakefile();
- const std::vector<cmValueWithOrigin> noconfig_compile_definitions =
+ const cmStringRange noconfig_compile_definitions =
mf->GetCompileDefinitionsEntries();
+ const cmBacktraceRange noconfig_compile_definitions_bts =
+ mf->GetCompileDefinitionsBacktraces();
cmTargets& targets = mf->GetTargets();
for(cmTargets::iterator ti = targets.begin();
@@ -1433,11 +1435,13 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo()
continue;
}
- for (std::vector<cmValueWithOrigin>::const_iterator it
+ cmBacktraceRange::const_iterator btIt
+ = noconfig_compile_definitions_bts.begin();
+ for (cmStringRange::const_iterator it
= noconfig_compile_definitions.begin();
- it != noconfig_compile_definitions.end(); ++it)
+ it != noconfig_compile_definitions.end(); ++it, ++btIt)
{
- t->InsertCompileDefinition(*it);
+ t->InsertCompileDefinition(*it, *btIt);
}
cmPolicies::PolicyStatus polSt
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index f96b4a8..6041fb7 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -247,7 +247,7 @@ bool cmListCommand::HandleAppendCommand(std::vector<std::string> const& args)
{
listString += ";";
}
- listString += cmJoin(cmRange(args).advance(2), ";");
+ listString += cmJoin(cmMakeRange(args).advance(2), ";");
this->Makefile->AddDefinition(listName, listString.c_str());
return true;
@@ -361,9 +361,9 @@ bool cmListCommand
std::vector<std::string>::const_iterator remBegin = remove.begin();
std::vector<std::string>::const_iterator argsEnd =
- cmRemoveMatching(varArgsExpanded, cmRange(remBegin, remEnd));
+ cmRemoveMatching(varArgsExpanded, cmMakeRange(remBegin, remEnd));
std::vector<std::string>::const_iterator argsBegin = varArgsExpanded.begin();
- std::string value = cmJoin(cmRange(argsBegin, argsEnd), ";");
+ std::string value = cmJoin(cmMakeRange(argsBegin, argsEnd), ";");
this->Makefile->AddDefinition(listName, value.c_str());
return true;
}
@@ -421,7 +421,7 @@ bool cmListCommand
cmRemoveDuplicates(varArgsExpanded);
std::vector<std::string>::const_iterator argsBegin =
varArgsExpanded.begin();
- std::string value = cmJoin(cmRange(argsBegin, argsEnd), ";");
+ std::string value = cmJoin(cmMakeRange(argsBegin, argsEnd), ";");
this->Makefile->AddDefinition(listName, value.c_str());
return true;
@@ -509,9 +509,9 @@ bool cmListCommand::HandleRemoveAtCommand(
std::vector<size_t>::const_iterator remBegin = removed.begin();
std::vector<std::string>::const_iterator argsEnd =
- cmRemoveIndices(varArgsExpanded, cmRange(remBegin, remEnd));
+ cmRemoveIndices(varArgsExpanded, cmMakeRange(remBegin, remEnd));
std::vector<std::string>::const_iterator argsBegin = varArgsExpanded.begin();
- std::string value = cmJoin(cmRange(argsBegin, argsEnd), ";");
+ std::string value = cmJoin(cmMakeRange(argsBegin, argsEnd), ";");
this->Makefile->AddDefinition(listName, value.c_str());
return true;
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 077d4d9..ca4d359 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -2259,7 +2259,7 @@ cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p,
std::string());
std::vector<std::string>::const_iterator compStart
= components.begin() + 1;
- result += cmJoin(cmRange(compStart, compEnd), slash);
+ result += cmJoin(cmMakeRange(compStart, compEnd), slash);
// Only the last component can be empty to avoid double slashes.
result += slash;
result += components.back();
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index fa5a623..e4026b0 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -107,7 +107,7 @@ bool cmMacroHelperCommand::InvokeInitialPass
std::vector<std::string>::const_iterator eit
= expandedArgs.begin() + (this->Args.size() - 1);
- std::string expandedArgn = cmJoin(cmRange(eit, expandedArgs.end()), ";");
+ std::string expandedArgn = cmJoin(cmMakeRange(eit, expandedArgs.end()), ";");
std::string expandedArgv = cmJoin(expandedArgs, ";");
std::vector<std::string> variables;
variables.reserve(this->Args.size() - 1);
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 7c98970..57e33df 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -273,6 +273,38 @@ void cmMakefile::IssueMessage(cmake::MessageType t,
}
}
+cmStringRange cmMakefile::GetIncludeDirectoriesEntries() const
+{
+ return this->StateSnapshot.GetDirectory().GetIncludeDirectoriesEntries();
+}
+
+cmBacktraceRange cmMakefile::GetIncludeDirectoriesBacktraces() const
+{
+ return this->StateSnapshot.GetDirectory()
+ .GetIncludeDirectoriesEntryBacktraces();
+}
+
+cmStringRange cmMakefile::GetCompileOptionsEntries() const
+{
+ return this->StateSnapshot.GetDirectory().GetCompileOptionsEntries();
+}
+
+cmBacktraceRange cmMakefile::GetCompileOptionsBacktraces() const
+{
+ return this->StateSnapshot.GetDirectory().GetCompileOptionsEntryBacktraces();
+}
+
+cmStringRange cmMakefile::GetCompileDefinitionsEntries() const
+{
+ return this->StateSnapshot.GetDirectory().GetCompileDefinitionsEntries();
+}
+
+cmBacktraceRange cmMakefile::GetCompileDefinitionsBacktraces() const
+{
+ return this->StateSnapshot.GetDirectory()
+ .GetCompileDefinitionsEntryBacktraces();
+}
+
//----------------------------------------------------------------------------
cmListFileBacktrace cmMakefile::GetBacktrace() const
{
@@ -1438,7 +1470,7 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove)
std::remove(defs.begin(), defs.end(), define);
std::vector<std::string>::const_iterator defBegin =
defs.begin();
- std::string ndefs = cmJoin(cmRange(defBegin, defEnd), ";");
+ std::string ndefs = cmJoin(cmMakeRange(defBegin, defEnd), ";");
// Store the new list.
this->SetProperty("COMPILE_DEFINITIONS", ndefs.c_str());
@@ -1533,29 +1565,13 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent)
// Initialize definitions with the closure of the parent scope.
this->Internal->InitializeDefinitions(parent);
+ this->StateSnapshot.InitializeFromParent();
+
this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR",
this->GetCurrentSourceDirectory());
this->AddDefinition("CMAKE_CURRENT_BINARY_DIR",
this->GetCurrentBinaryDirectory());
- const std::vector<cmValueWithOrigin>& parentIncludes =
- parent->GetIncludeDirectoriesEntries();
- this->IncludeDirectoriesEntries.insert(this->IncludeDirectoriesEntries.end(),
- parentIncludes.begin(),
- parentIncludes.end());
-
- const std::vector<cmValueWithOrigin>& parentOptions =
- parent->GetCompileOptionsEntries();
- this->CompileOptionsEntries.insert(this->CompileOptionsEntries.end(),
- 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
@@ -1898,20 +1914,25 @@ void cmMakefile::AddIncludeDirectories(const std::vector<std::string> &incs,
return;
}
- std::vector<cmValueWithOrigin>::iterator position =
- before ? this->IncludeDirectoriesEntries.begin()
- : this->IncludeDirectoriesEntries.end();
-
cmListFileBacktrace lfbt = this->GetBacktrace();
- cmValueWithOrigin entry(cmJoin(incs, ";"), lfbt);
- this->IncludeDirectoriesEntries.insert(position, entry);
+ std::string entryString = cmJoin(incs, ";");
+ if (before)
+ {
+ this->StateSnapshot.GetDirectory()
+ .PrependIncludeDirectoriesEntry(entryString, lfbt);
+ }
+ else
+ {
+ this->StateSnapshot.GetDirectory()
+ .AppendIncludeDirectoriesEntry(entryString, lfbt);
+ }
// Property on each target:
for (cmTargets::iterator l = this->Targets.begin();
l != this->Targets.end(); ++l)
{
cmTarget &t = l->second;
- t.InsertInclude(entry, before);
+ t.InsertInclude(entryString, lfbt, before);
}
}
@@ -4130,37 +4151,35 @@ void cmMakefile::SetProperty(const std::string& prop, const char* value)
{
if (prop == "INCLUDE_DIRECTORIES")
{
- this->IncludeDirectoriesEntries.clear();
if (!value)
{
+ this->StateSnapshot.GetDirectory().ClearIncludeDirectories();
return;
}
cmListFileBacktrace lfbt = this->GetBacktrace();
- this->IncludeDirectoriesEntries.push_back(
- cmValueWithOrigin(value, lfbt));
+ this->StateSnapshot.GetDirectory().SetIncludeDirectories(value, lfbt);
return;
}
if (prop == "COMPILE_OPTIONS")
{
- this->CompileOptionsEntries.clear();
if (!value)
{
+ this->StateSnapshot.GetDirectory().ClearCompileOptions();
return;
}
cmListFileBacktrace lfbt = this->GetBacktrace();
- this->CompileOptionsEntries.push_back(cmValueWithOrigin(value, lfbt));
+ this->StateSnapshot.GetDirectory().SetCompileOptions(value, lfbt);
return;
}
if (prop == "COMPILE_DEFINITIONS")
{
- this->CompileDefinitionsEntries.clear();
if (!value)
{
+ this->StateSnapshot.GetDirectory().ClearCompileDefinitions();
return;
}
cmListFileBacktrace lfbt = this->GetBacktrace();
- cmValueWithOrigin entry(value, lfbt);
- this->CompileDefinitionsEntries.push_back(entry);
+ this->StateSnapshot.GetDirectory().SetCompileDefinitions(value, lfbt);
return;
}
@@ -4174,22 +4193,21 @@ void cmMakefile::AppendProperty(const std::string& prop,
if (prop == "INCLUDE_DIRECTORIES")
{
cmListFileBacktrace lfbt = this->GetBacktrace();
- this->IncludeDirectoriesEntries.push_back(
- cmValueWithOrigin(value, lfbt));
+ this->StateSnapshot.GetDirectory().AppendIncludeDirectoriesEntry(value,
+ lfbt);
return;
}
if (prop == "COMPILE_OPTIONS")
{
cmListFileBacktrace lfbt = this->GetBacktrace();
- this->CompileOptionsEntries.push_back(
- cmValueWithOrigin(value, lfbt));
+ this->StateSnapshot.GetDirectory().AppendCompileOptionsEntry(value, lfbt);
return;
}
if (prop == "COMPILE_DEFINITIONS")
{
cmListFileBacktrace lfbt = this->GetBacktrace();
- this->CompileDefinitionsEntries.push_back(
- cmValueWithOrigin(value, lfbt));
+ this->StateSnapshot.GetDirectory().AppendCompileDefinitionsEntry(value,
+ lfbt);
return;
}
@@ -4244,44 +4262,20 @@ const char *cmMakefile::GetProperty(const std::string& prop,
}
else if (prop == "INCLUDE_DIRECTORIES")
{
- std::string sep;
- for (std::vector<cmValueWithOrigin>::const_iterator
- it = this->IncludeDirectoriesEntries.begin(),
- end = this->IncludeDirectoriesEntries.end();
- it != end; ++it)
- {
- output += sep;
- output += it->Value;
- sep = ";";
- }
+ output = cmJoin(this->StateSnapshot.GetDirectory()
+ .GetIncludeDirectoriesEntries(), ";");
return output.c_str();
}
else if (prop == "COMPILE_OPTIONS")
{
- std::string sep;
- for (std::vector<cmValueWithOrigin>::const_iterator
- it = this->CompileOptionsEntries.begin(),
- end = this->CompileOptionsEntries.end();
- it != end; ++it)
- {
- output += sep;
- output += it->Value;
- sep = ";";
- }
+ output = cmJoin(this->StateSnapshot.GetDirectory()
+ .GetCompileOptionsEntries(), ";");
return output.c_str();
}
else if (prop == "COMPILE_DEFINITIONS")
{
- 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 = ";";
- }
+ output = cmJoin(this->StateSnapshot.GetDirectory()
+ .GetCompileDefinitionsEntries(), ";");
return output.c_str();
}
@@ -4753,53 +4747,30 @@ const char* cmMakefile::GetDefineFlagsCMP0059() const
cmPolicies::PolicyStatus
cmMakefile::GetPolicyStatus(cmPolicies::PolicyID id) const
{
- // Get the current setting of the policy.
- cmPolicies::PolicyStatus cur = this->GetPolicyStatusInternal(id);
+ cmPolicies::PolicyStatus status = cmPolicies::GetPolicyStatus(id);
- // If the policy is required to be set to NEW but is not, ignore the
- // current setting and tell the caller.
- if(cur != cmPolicies::NEW)
+ if(status == cmPolicies::REQUIRED_ALWAYS ||
+ status == cmPolicies::REQUIRED_IF_USED)
{
- if(cur == cmPolicies::REQUIRED_ALWAYS ||
- cur == cmPolicies::REQUIRED_IF_USED)
- {
- return cur;
- }
- cmPolicies::PolicyStatus def = cmPolicies::GetPolicyStatus(id);
- if(def == cmPolicies::REQUIRED_ALWAYS ||
- def == cmPolicies::REQUIRED_IF_USED)
- {
- return def;
- }
+ return status;
}
- // The current setting is okay.
- return cur;
-}
-
-//----------------------------------------------------------------------------
-cmPolicies::PolicyStatus
-cmMakefile::GetPolicyStatusInternal(cmPolicies::PolicyID id) const
-{
- // Is the policy set in our stack?
- for(PolicyStackType::const_reverse_iterator psi = this->PolicyStack.rbegin();
- psi != this->PolicyStack.rend(); ++psi)
+ cmLocalGenerator* lg = this->LocalGenerator;
+ while(lg)
{
- if(psi->IsDefined(id))
+ cmMakefile const* mf = lg->GetMakefile();
+ for(PolicyStackType::const_reverse_iterator psi =
+ mf->PolicyStack.rbegin(); psi != mf->PolicyStack.rend(); ++psi)
{
- return psi->Get(id);
+ if(psi->IsDefined(id))
+ {
+ status = psi->Get(id);
+ return status;
+ }
}
+ lg = lg->GetParent();
}
-
- // If we have a parent directory, recurse up to it.
- if(this->LocalGenerator->GetParent())
- {
- cmMakefile* parent = this->LocalGenerator->GetParent()->GetMakefile();
- return parent->GetPolicyStatusInternal(id);
- }
-
- // The policy is not set. Use the default for this CMake version.
- return cmPolicies::GetPolicyStatus(id);
+ return status;
}
//----------------------------------------------------------------------------
@@ -4857,25 +4828,6 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id,
previous_was_weak = psi->Weak;
}
- // Special hook for presenting compatibility variable as soon as
- // the user requests it.
- if(id == cmPolicies::CMP0001 &&
- (status == cmPolicies::WARN || status == cmPolicies::OLD))
- {
- if(!(this->GetState()
- ->GetInitializedCacheValue("CMAKE_BACKWARDS_COMPATIBILITY")))
- {
- // Set it to 2.4 because that is the last version where the
- // variable had meaning.
- this->AddCacheDefinition
- ("CMAKE_BACKWARDS_COMPATIBILITY", "2.4",
- "For backwards compatibility, what version of CMake "
- "commands and "
- "syntax should this version of CMake try to support.",
- cmState::STRING);
- }
- }
-
return true;
}
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 2fc4d78..07342ea 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -22,6 +22,7 @@
#include "cmExpandedCommandArgument.h"
#include "cmake.h"
#include "cmState.h"
+#include "cmAlgorithms.h"
#if defined(CMAKE_BUILD_WITH_CMAKE)
#include "cmSourceGroup.h"
@@ -746,18 +747,12 @@ public:
/** Set whether or not to report a CMP0000 violation. */
void SetCheckCMP0000(bool b) { this->CheckCMP0000 = b; }
- const std::vector<cmValueWithOrigin>& GetIncludeDirectoriesEntries() const
- {
- return this->IncludeDirectoriesEntries;
- }
- const std::vector<cmValueWithOrigin>& GetCompileOptionsEntries() const
- {
- return this->CompileOptionsEntries;
- }
- const std::vector<cmValueWithOrigin>& GetCompileDefinitionsEntries() const
- {
- return this->CompileDefinitionsEntries;
- }
+ cmStringRange GetIncludeDirectoriesEntries() const;
+ cmBacktraceRange GetIncludeDirectoriesBacktraces() const;
+ cmStringRange GetCompileOptionsEntries() const;
+ cmBacktraceRange GetCompileOptionsBacktraces() const;
+ cmStringRange GetCompileDefinitionsEntries() const;
+ cmBacktraceRange GetCompileDefinitionsBacktraces() const;
bool IsConfigured() const { return this->Configured; }
void SetConfigured(){ this->Configured = true; }
@@ -851,10 +846,6 @@ protected:
std::vector<std::string> HeaderFileExtensions;
std::string DefineFlags;
- 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&);
void RemoveDefineFlag(const char*, std::string::size_type, std::string&);
@@ -938,8 +929,6 @@ private:
typedef std::vector<PolicyStackEntry> PolicyStackType;
PolicyStackType PolicyStack;
std::vector<PolicyStackType::size_type> PolicyBarriers;
- cmPolicies::PolicyStatus
- GetPolicyStatusInternal(cmPolicies::PolicyID id) const;
// CMP0053 == old
cmake::MessageType ExpandVariablesInStringOld(
diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx
index 0449c50..2854a82 100644
--- a/Source/cmMessageCommand.cxx
+++ b/Source/cmMessageCommand.cxx
@@ -69,7 +69,7 @@ bool cmMessageCommand
++i;
}
- std::string message = cmJoin(cmRange(i, args.end()), std::string());
+ std::string message = cmJoin(cmMakeRange(i, args.end()), std::string());
if (type != cmake::MESSAGE)
{
diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx
index 91f3c0a..7be5b3f 100644
--- a/Source/cmOutputConverter.cxx
+++ b/Source/cmOutputConverter.cxx
@@ -293,7 +293,7 @@ cmOutputConverter::ConvertToRelativePath(const std::vector<std::string>& local,
{
relative += "/";
}
- relative += cmJoin(cmRange(remote).advance(common), "/");
+ relative += cmJoin(cmMakeRange(remote).advance(common), "/");
// Finally return the path.
return relative;
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 5026893..3eb19bb 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -255,6 +255,22 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
{
return false;
}
+ if(pid == cmPolicies::CMP0001 &&
+ (status == cmPolicies::WARN || status == cmPolicies::OLD))
+ {
+ if(!(mf->GetState()
+ ->GetInitializedCacheValue("CMAKE_BACKWARDS_COMPATIBILITY")))
+ {
+ // Set it to 2.4 because that is the last version where the
+ // variable had meaning.
+ mf->AddCacheDefinition
+ ("CMAKE_BACKWARDS_COMPATIBILITY", "2.4",
+ "For backwards compatibility, what version of CMake "
+ "commands and "
+ "syntax should this version of CMake try to support.",
+ cmState::STRING);
+ }
+ }
}
}
else
@@ -356,14 +372,6 @@ cmPolicies::PolicyMap::Get(cmPolicies::PolicyID id) const
{
status = cmPolicies::NEW;
}
- else if (this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_ALWAYS])
- {
- status = cmPolicies::REQUIRED_ALWAYS;
- }
- else if (this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_IF_USED])
- {
- status = cmPolicies::REQUIRED_IF_USED;
- }
return status;
}
@@ -373,19 +381,13 @@ void cmPolicies::PolicyMap::Set(cmPolicies::PolicyID id,
this->Status[(POLICY_STATUS_COUNT * id) + OLD] = (status == OLD);
this->Status[(POLICY_STATUS_COUNT * id) + WARN] = (status == WARN);
this->Status[(POLICY_STATUS_COUNT * id) + NEW] = (status == NEW);
- this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_ALWAYS] =
- (status == REQUIRED_ALWAYS);
- this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_IF_USED] =
- (status == REQUIRED_IF_USED);
}
bool cmPolicies::PolicyMap::IsDefined(cmPolicies::PolicyID id) const
{
return this->Status[(POLICY_STATUS_COUNT * id) + OLD]
|| this->Status[(POLICY_STATUS_COUNT * id) + WARN]
- || this->Status[(POLICY_STATUS_COUNT * id) + NEW]
- || this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_ALWAYS]
- || this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_IF_USED];
+ || this->Status[(POLICY_STATUS_COUNT * id) + NEW];
}
bool cmPolicies::PolicyMap::IsEmpty() const
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 8a3c27d..b783701 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -12,7 +12,7 @@
#ifndef cmPolicies_h
#define cmPolicies_h
-#include "cmCustomCommand.h"
+#include "cmStandardIncludes.h"
#include <bitset>
@@ -244,7 +244,6 @@ public:
REQUIRED_IF_USED,
REQUIRED_ALWAYS ///< Issue an error unless user sets policy status to NEW.
};
-#define POLICY_STATUS_COUNT 5
/// Policy identifiers
enum PolicyID
@@ -288,6 +287,7 @@ public:
bool IsEmpty() const;
private:
+#define POLICY_STATUS_COUNT 3
std::bitset<cmPolicies::CMPCOUNT * POLICY_STATUS_COUNT> Status;
};
};
diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx
index bf9f42c..306276b 100644
--- a/Source/cmSetCommand.cxx
+++ b/Source/cmSetCommand.cxx
@@ -108,7 +108,7 @@ bool cmSetCommand
}
// collect any values into a single semi-colon separated value list
- value = cmJoin(cmRange(args).advance(1).retreat(ignoreLastArgs), ";");
+ value = cmJoin(cmMakeRange(args).advance(1).retreat(ignoreLastArgs), ";");
if (parentScope)
{
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 9cbb841..d8f8306 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -28,6 +28,9 @@ struct cmState::SnapshotDataType
BuildSystemDirectory;
std::string EntryPointCommand;
long EntryPointLine;
+ std::vector<std::string>::size_type IncludeDirectoryPosition;
+ std::vector<std::string>::size_type CompileDefinitionsPosition;
+ std::vector<std::string>::size_type CompileOptionsPosition;
};
struct cmState::BuildsystemDirectoryStateType
@@ -44,6 +47,15 @@ struct cmState::BuildsystemDirectoryStateType
// safely by the build tools.
std::string RelativePathTopSource;
std::string RelativePathTopBinary;
+
+ std::vector<std::string> IncludeDirectories;
+ std::vector<cmListFileBacktrace> IncludeDirectoryBacktraces;
+
+ std::vector<std::string> CompileDefinitions;
+ std::vector<cmListFileBacktrace> CompileDefinitionsBacktraces;
+
+ std::vector<std::string> CompileOptions;
+ std::vector<cmListFileBacktrace> CompileOptionsBacktraces;
};
cmState::cmState(cmake* cm)
@@ -228,7 +240,16 @@ cmState::Snapshot cmState::Reset()
this->GlobalProperties.clear();
this->PropertyDefinitions.clear();
- this->BuildsystemDirectory.Truncate();
+ {
+ cmLinkedTree<BuildsystemDirectoryStateType>::iterator it =
+ this->BuildsystemDirectory.Truncate();
+ it->IncludeDirectories.clear();
+ it->IncludeDirectoryBacktraces.clear();
+ it->CompileDefinitions.clear();
+ it->CompileDefinitionsBacktraces.clear();
+ it->CompileOptions.clear();
+ it->CompileOptionsBacktraces.clear();
+ }
PositionType pos = this->SnapshotData.Truncate();
this->ExecutionListFiles.Truncate();
@@ -698,6 +719,9 @@ cmState::Snapshot cmState::CreateBaseSnapshot()
this->BuildsystemDirectory.Extend(this->BuildsystemDirectory.Root());
pos->ExecutionListFile =
this->ExecutionListFiles.Extend(this->ExecutionListFiles.Root());
+ pos->IncludeDirectoryPosition = 0;
+ pos->CompileDefinitionsPosition = 0;
+ pos->CompileOptionsPosition = 0;
return cmState::Snapshot(this, pos);
}
@@ -796,6 +820,13 @@ cmState::Snapshot cmState::Pop(cmState::Snapshot originSnapshot)
PositionType pos = originSnapshot.Position;
PositionType prevPos = pos;
++prevPos;
+ prevPos->IncludeDirectoryPosition =
+ prevPos->BuildSystemDirectory->IncludeDirectories.size();
+ prevPos->CompileDefinitionsPosition =
+ prevPos->BuildSystemDirectory->CompileDefinitions.size();
+ prevPos->CompileOptionsPosition =
+ prevPos->BuildSystemDirectory->CompileOptions.size();
+
if (prevPos == this->SnapshotData.Root())
{
return Snapshot(this, prevPos);
@@ -803,6 +834,12 @@ cmState::Snapshot cmState::Pop(cmState::Snapshot originSnapshot)
return Snapshot(this, originSnapshot.Position->CallStackParent);
}
+cmState::Snapshot::Snapshot(cmState* state)
+ : State(state)
+ , Position()
+{
+}
+
cmState::Snapshot::Snapshot(cmState* state, PositionType position)
: State(state),
Position(position)
@@ -943,6 +980,62 @@ cmState::Snapshot cmState::Snapshot::GetCallStackParent() const
return snapshot;
}
+static const std::string cmPropertySentinal = std::string();
+
+template<typename T, typename U, typename V>
+void InitializeContentFromParent(T& parentContent,
+ T& thisContent,
+ U& parentBacktraces,
+ U& thisBacktraces,
+ V& contentEndPosition)
+{
+ std::vector<std::string>::const_iterator parentBegin =
+ parentContent.begin();
+ std::vector<std::string>::const_iterator parentEnd =
+ parentContent.end();
+
+ std::vector<std::string>::const_reverse_iterator parentRbegin =
+ cmMakeReverseIterator(parentEnd);
+ std::vector<std::string>::const_reverse_iterator parentRend =
+ parentContent.rend();
+ parentRbegin = std::find(parentRbegin, parentRend, cmPropertySentinal);
+ std::vector<std::string>::const_iterator parentIt = parentRbegin.base();
+
+ thisContent = std::vector<std::string>(parentIt, parentEnd);
+
+ std::vector<cmListFileBacktrace>::const_iterator btIt =
+ parentBacktraces.begin() + std::distance(parentBegin, parentIt);
+ std::vector<cmListFileBacktrace>::const_iterator btEnd =
+ parentBacktraces.end();
+
+ thisBacktraces = std::vector<cmListFileBacktrace>(btIt, btEnd);
+
+ contentEndPosition = thisContent.size();
+}
+
+void cmState::Snapshot::InitializeFromParent()
+{
+ PositionType parent = this->Position->DirectoryParent;
+
+ InitializeContentFromParent(parent->BuildSystemDirectory->IncludeDirectories,
+ this->Position->BuildSystemDirectory->IncludeDirectories,
+ parent->BuildSystemDirectory->IncludeDirectoryBacktraces,
+ this->Position->BuildSystemDirectory->IncludeDirectoryBacktraces,
+ this->Position->IncludeDirectoryPosition);
+
+ InitializeContentFromParent(parent->BuildSystemDirectory->CompileDefinitions,
+ this->Position->BuildSystemDirectory->CompileDefinitions,
+ parent->BuildSystemDirectory->CompileDefinitionsBacktraces,
+ this->Position->BuildSystemDirectory->CompileDefinitionsBacktraces,
+ this->Position->CompileDefinitionsPosition);
+
+ InitializeContentFromParent(parent->BuildSystemDirectory->CompileOptions,
+ this->Position->BuildSystemDirectory->CompileOptions,
+ parent->BuildSystemDirectory->CompileOptionsBacktraces,
+ this->Position->BuildSystemDirectory->CompileOptionsBacktraces,
+ this->Position->CompileOptionsPosition);
+}
+
cmState* cmState::Snapshot::GetState() const
{
return this->State;
@@ -960,3 +1053,220 @@ cmState::Directory::Directory(
{
}
+
+template <typename T, typename U>
+cmStringRange GetPropertyContent(T const& content, U contentEndPosition)
+{
+ std::vector<std::string>::const_iterator end =
+ content.begin() + contentEndPosition;
+
+ std::vector<std::string>::const_reverse_iterator rbegin =
+ cmMakeReverseIterator(end);
+ rbegin = std::find(rbegin, content.rend(), cmPropertySentinal);
+
+ return cmMakeRange(rbegin.base(), end);
+}
+
+template <typename T, typename U, typename V>
+cmBacktraceRange GetPropertyBacktraces(T const& content,
+ U const& backtraces,
+ V contentEndPosition)
+{
+ std::vector<std::string>::const_iterator entryEnd =
+ content.begin() + contentEndPosition;
+
+ std::vector<std::string>::const_reverse_iterator rbegin =
+ cmMakeReverseIterator(entryEnd);
+ rbegin = std::find(rbegin, content.rend(), cmPropertySentinal);
+
+ std::vector<cmListFileBacktrace>::const_iterator it =
+ backtraces.begin() + std::distance(content.begin(), rbegin.base());
+
+ std::vector<cmListFileBacktrace>::const_iterator end = backtraces.end();
+ return cmMakeRange(it, end);
+}
+
+template <typename T, typename U, typename V>
+void AppendEntry(T& content, U& backtraces, V& endContentPosition,
+ const std::string& vec, const cmListFileBacktrace& lfbt)
+{
+ assert(endContentPosition == content.size());
+
+ content.push_back(vec);
+ backtraces.push_back(lfbt);
+
+ endContentPosition = content.size();
+}
+
+template <typename T, typename U, typename V>
+void SetContent(T& content, U& backtraces, V& endContentPosition,
+ const std::string& vec, const cmListFileBacktrace& lfbt)
+{
+ assert(endContentPosition == content.size());
+
+ content.resize(content.size() + 2);
+ backtraces.resize(backtraces.size() + 2);
+
+ content.back() = vec;
+ backtraces.back() = lfbt;
+
+ endContentPosition = content.size();
+}
+
+template <typename T, typename U, typename V>
+void ClearContent(T& content, U& backtraces, V& endContentPosition)
+{
+ assert(endContentPosition == content.size());
+
+ content.resize(content.size() + 1);
+ backtraces.resize(backtraces.size() + 1);
+
+ endContentPosition = content.size();
+}
+
+cmStringRange
+cmState::Directory::GetIncludeDirectoriesEntries() const
+{
+ return GetPropertyContent(this->DirectoryState->IncludeDirectories,
+ this->Snapshot_.Position->IncludeDirectoryPosition);
+}
+
+cmBacktraceRange
+cmState::Directory::GetIncludeDirectoriesEntryBacktraces() const
+{
+ return GetPropertyBacktraces(this->DirectoryState->IncludeDirectories,
+ this->DirectoryState->IncludeDirectoryBacktraces,
+ this->Snapshot_.Position->IncludeDirectoryPosition);
+}
+
+void cmState::Directory::AppendIncludeDirectoriesEntry(
+ const std::string& vec, const cmListFileBacktrace& lfbt)
+{
+ AppendEntry(this->DirectoryState->IncludeDirectories,
+ this->DirectoryState->IncludeDirectoryBacktraces,
+ this->Snapshot_.Position->IncludeDirectoryPosition,
+ vec, lfbt);
+}
+
+void cmState::Directory::PrependIncludeDirectoriesEntry(
+ const std::string& vec, const cmListFileBacktrace& lfbt)
+{
+ std::vector<std::string>::iterator entryEnd =
+ this->DirectoryState->IncludeDirectories.begin()
+ + this->Snapshot_.Position->IncludeDirectoryPosition;
+
+ std::vector<std::string>::const_reverse_iterator rend =
+ this->DirectoryState->IncludeDirectories.rend();
+ std::vector<std::string>::reverse_iterator rbegin =
+ cmMakeReverseIterator(entryEnd);
+ std::vector<std::string>::const_reverse_iterator crbegin = rbegin;
+ crbegin = std::find(crbegin, rend, cmPropertySentinal);
+
+ std::vector<std::string>::const_iterator entryIt = crbegin.base();
+ std::vector<std::string>::const_iterator entryBegin =
+ this->DirectoryState->IncludeDirectories.begin();
+
+ std::vector<cmListFileBacktrace>::iterator btIt =
+ this->DirectoryState->IncludeDirectoryBacktraces.begin()
+ + std::distance(entryBegin, entryIt);
+
+ this->DirectoryState->IncludeDirectories.insert(rbegin.base(), vec);
+ this->DirectoryState->IncludeDirectoryBacktraces.insert(btIt, lfbt);
+
+ this->Snapshot_.Position->IncludeDirectoryPosition =
+ this->DirectoryState->IncludeDirectories.size();
+}
+
+void cmState::Directory::SetIncludeDirectories(
+ const std::string& vec, const cmListFileBacktrace& lfbt)
+{
+ SetContent(this->DirectoryState->IncludeDirectories,
+ this->DirectoryState->IncludeDirectoryBacktraces,
+ this->Snapshot_.Position->IncludeDirectoryPosition,
+ vec, lfbt);
+}
+
+void cmState::Directory::ClearIncludeDirectories()
+{
+ ClearContent(this->DirectoryState->IncludeDirectories,
+ this->DirectoryState->IncludeDirectoryBacktraces,
+ this->Snapshot_.Position->IncludeDirectoryPosition);
+}
+
+cmStringRange cmState::Directory::GetCompileDefinitionsEntries() const
+{
+ return GetPropertyContent(this->DirectoryState->CompileDefinitions,
+ this->Snapshot_.Position->CompileDefinitionsPosition);
+}
+
+cmBacktraceRange
+cmState::Directory::GetCompileDefinitionsEntryBacktraces() const
+{
+ return GetPropertyBacktraces(this->DirectoryState->CompileDefinitions,
+ this->DirectoryState->CompileDefinitionsBacktraces,
+ this->Snapshot_.Position->CompileDefinitionsPosition);
+}
+
+void cmState::Directory::AppendCompileDefinitionsEntry(const std::string& vec,
+ const cmListFileBacktrace& lfbt)
+{
+ AppendEntry(this->DirectoryState->CompileDefinitions,
+ this->DirectoryState->CompileDefinitionsBacktraces,
+ this->Snapshot_.Position->CompileDefinitionsPosition,
+ vec, lfbt);
+}
+
+void cmState::Directory::SetCompileDefinitions(const std::string& vec,
+ const cmListFileBacktrace& lfbt)
+{
+ SetContent(this->DirectoryState->CompileDefinitions,
+ this->DirectoryState->CompileDefinitionsBacktraces,
+ this->Snapshot_.Position->CompileDefinitionsPosition,
+ vec, lfbt);
+}
+
+void cmState::Directory::ClearCompileDefinitions()
+{
+ ClearContent(this->DirectoryState->CompileDefinitions,
+ this->DirectoryState->CompileDefinitionsBacktraces,
+ this->Snapshot_.Position->CompileDefinitionsPosition);
+}
+
+cmStringRange cmState::Directory::GetCompileOptionsEntries() const
+{
+ return GetPropertyContent(this->DirectoryState->CompileOptions,
+ this->Snapshot_.Position->CompileOptionsPosition);
+}
+
+cmBacktraceRange cmState::Directory::GetCompileOptionsEntryBacktraces() const
+{
+ return GetPropertyBacktraces(this->DirectoryState->CompileOptions,
+ this->DirectoryState->CompileOptionsBacktraces,
+ this->Snapshot_.Position->CompileOptionsPosition);
+}
+
+void
+cmState::Directory::AppendCompileOptionsEntry(const std::string& vec,
+ const cmListFileBacktrace& lfbt)
+{
+ AppendEntry(this->DirectoryState->CompileOptions,
+ this->DirectoryState->CompileOptionsBacktraces,
+ this->Snapshot_.Position->CompileOptionsPosition,
+ vec, lfbt);
+}
+
+void cmState::Directory::SetCompileOptions(const std::string& vec,
+ const cmListFileBacktrace& lfbt)
+{
+ SetContent(this->DirectoryState->CompileOptions,
+ this->DirectoryState->CompileOptionsBacktraces,
+ this->Snapshot_.Position->CompileOptionsPosition,
+ vec, lfbt);
+}
+
+void cmState::Directory::ClearCompileOptions()
+{
+ ClearContent(this->DirectoryState->CompileOptions,
+ this->DirectoryState->CompileOptionsBacktraces,
+ this->Snapshot_.Position->CompileOptionsPosition);
+}
diff --git a/Source/cmState.h b/Source/cmState.h
index acd23a5..0d5300f 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -16,6 +16,7 @@
#include "cmPropertyDefinitionMap.h"
#include "cmPropertyMap.h"
#include "cmLinkedTree.h"
+#include "cmAlgorithms.h"
class cmake;
class cmCommand;
@@ -43,7 +44,8 @@ public:
class Snapshot {
public:
- Snapshot(cmState* state = 0, PositionType position = PositionType());
+ Snapshot(cmState* state = 0);
+ Snapshot(cmState* state, PositionType position);
void SetListFile(std::string const& listfile);
@@ -55,6 +57,8 @@ public:
Snapshot GetBuildsystemDirectoryParent() const;
Snapshot GetCallStackParent() const;
+ void InitializeFromParent();
+
cmState* GetState() const;
Directory GetDirectory() const;
@@ -86,6 +90,32 @@ public:
void SetRelativePathTopSource(const char* dir);
void SetRelativePathTopBinary(const char* dir);
+ cmStringRange GetIncludeDirectoriesEntries() const;
+ cmBacktraceRange GetIncludeDirectoriesEntryBacktraces() const;
+ void AppendIncludeDirectoriesEntry(std::string const& vec,
+ cmListFileBacktrace const& lfbt);
+ void PrependIncludeDirectoriesEntry(std::string const& vec,
+ cmListFileBacktrace const& lfbt);
+ void SetIncludeDirectories(std::string const& vec,
+ cmListFileBacktrace const& lfbt);
+ void ClearIncludeDirectories();
+
+ cmStringRange GetCompileDefinitionsEntries() const;
+ cmBacktraceRange GetCompileDefinitionsEntryBacktraces() const;
+ void AppendCompileDefinitionsEntry(std::string const& vec,
+ cmListFileBacktrace const& lfbt);
+ void SetCompileDefinitions(std::string const& vec,
+ cmListFileBacktrace const& lfbt);
+ void ClearCompileDefinitions();
+
+ cmStringRange GetCompileOptionsEntries() const;
+ cmBacktraceRange GetCompileOptionsEntryBacktraces() const;
+ void AppendCompileOptionsEntry(std::string const& vec,
+ cmListFileBacktrace const& lfbt);
+ void SetCompileOptions(std::string const& vec,
+ cmListFileBacktrace const& lfbt);
+ void ClearCompileOptions();
+
private:
void ComputeRelativePathTopSource();
void ComputeRelativePathTopBinary();
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index efc1f16..649fb39 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -319,7 +319,7 @@ bool cmStringCommand::RegexMatch(std::vector<std::string> const& args)
}
// Concatenate all the last arguments together.
- std::string input = cmJoin(cmRange(args).advance(4), std::string());
+ std::string input = cmJoin(cmMakeRange(args).advance(4), std::string());
// Scan through the input for all matches.
std::string output;
@@ -365,7 +365,7 @@ bool cmStringCommand::RegexMatchAll(std::vector<std::string> const& args)
}
// Concatenate all the last arguments together.
- std::string input = cmJoin(cmRange(args).advance(4), std::string());
+ std::string input = cmJoin(cmMakeRange(args).advance(4), std::string());
// Scan through the input for all matches.
std::string output;
@@ -465,7 +465,7 @@ bool cmStringCommand::RegexReplace(std::vector<std::string> const& args)
}
// Concatenate all the last arguments together.
- std::string input = cmJoin(cmRange(args).advance(5), std::string());
+ std::string input = cmJoin(cmMakeRange(args).advance(5), std::string());
// Scan through the input for all matches.
std::string output;
@@ -665,7 +665,7 @@ bool cmStringCommand::HandleReplaceCommand(std::vector<std::string> const&
const std::string& replaceExpression = args[2];
const std::string& variableName = args[3];
- std::string input = cmJoin(cmRange(args).advance(4), std::string());
+ std::string input = cmJoin(cmMakeRange(args).advance(4), std::string());
cmsys::SystemTools::ReplaceString(input, matchExpression.c_str(),
replaceExpression.c_str());
@@ -756,7 +756,7 @@ bool cmStringCommand::HandleAppendCommand(std::vector<std::string> const& args)
{
value = oldValue;
}
- value += cmJoin(cmRange(args).advance(2), std::string());
+ value += cmJoin(cmMakeRange(args).advance(2), std::string());
this->Makefile->AddDefinition(variable, value.c_str());
return true;
}
@@ -772,7 +772,7 @@ bool cmStringCommand
}
std::string const& variableName = args[1];
- std::string value = cmJoin(cmRange(args).advance(2), std::string());
+ std::string value = cmJoin(cmMakeRange(args).advance(2), std::string());
this->Makefile->AddDefinition(variableName, value.c_str());
return true;
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 46e9ed4..8520e29 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -402,13 +402,17 @@ void cmTarget::SetMakefile(cmMakefile* mf)
{
// Initialize the INCLUDE_DIRECTORIES property based on the current value
// of the same directory property:
- const std::vector<cmValueWithOrigin> parentIncludes =
- this->Makefile->GetIncludeDirectoriesEntries();
+ const cmStringRange parentIncludes =
+ this->Makefile->GetIncludeDirectoriesEntries();
+ const cmBacktraceRange parentIncludesBts =
+ this->Makefile->GetIncludeDirectoriesBacktraces();
- for (std::vector<cmValueWithOrigin>::const_iterator it
- = parentIncludes.begin(); it != parentIncludes.end(); ++it)
+ cmBacktraceRange::const_iterator btIt = parentIncludesBts.begin();
+ for (cmStringRange::const_iterator it
+ = parentIncludes.begin();
+ it != parentIncludes.end(); ++it, ++btIt)
{
- this->InsertInclude(*it);
+ this->InsertInclude(*it, *btIt);
}
const std::set<std::string> parentSystemIncludes =
this->Makefile->GetSystemIncludeDirectories();
@@ -416,13 +420,17 @@ void cmTarget::SetMakefile(cmMakefile* mf)
this->SystemIncludeDirectories.insert(parentSystemIncludes.begin(),
parentSystemIncludes.end());
- const std::vector<cmValueWithOrigin> parentOptions =
+ const cmStringRange parentOptions =
this->Makefile->GetCompileOptionsEntries();
+ const cmBacktraceRange parentOptionsBts =
+ this->Makefile->GetCompileOptionsBacktraces();
- for (std::vector<cmValueWithOrigin>::const_iterator it
- = parentOptions.begin(); it != parentOptions.end(); ++it)
+ btIt = parentOptionsBts.begin();
+ for (cmStringRange::const_iterator it
+ = parentOptions.begin();
+ it != parentOptions.end(); ++it, ++btIt)
{
- this->InsertCompileOption(*it);
+ this->InsertCompileOption(*it, *btIt);
}
}
@@ -1926,40 +1934,43 @@ void cmTarget::AppendBuildInterfaceIncludes()
}
//----------------------------------------------------------------------------
-void cmTarget::InsertInclude(const cmValueWithOrigin &entry,
- bool before)
+void cmTarget::InsertInclude(std::string const& entry,
+ cmListFileBacktrace const& bt,
+ bool before)
{
- cmGeneratorExpression ge(entry.Backtrace);
+ cmGeneratorExpression ge(bt);
std::vector<cmTargetInternals::TargetPropertyEntry*>::iterator position
= before ? this->Internal->IncludeDirectoriesEntries.begin()
: this->Internal->IncludeDirectoriesEntries.end();
this->Internal->IncludeDirectoriesEntries.insert(position,
- new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry.Value)));
+ new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry)));
}
//----------------------------------------------------------------------------
-void cmTarget::InsertCompileOption(const cmValueWithOrigin &entry,
- bool before)
+void cmTarget::InsertCompileOption(std::string const& entry,
+ cmListFileBacktrace const& bt,
+ bool before)
{
- cmGeneratorExpression ge(entry.Backtrace);
+ cmGeneratorExpression ge(bt);
std::vector<cmTargetInternals::TargetPropertyEntry*>::iterator position
= before ? this->Internal->CompileOptionsEntries.begin()
: this->Internal->CompileOptionsEntries.end();
this->Internal->CompileOptionsEntries.insert(position,
- new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry.Value)));
+ new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry)));
}
//----------------------------------------------------------------------------
-void cmTarget::InsertCompileDefinition(const cmValueWithOrigin &entry)
+void cmTarget::InsertCompileDefinition(std::string const& entry,
+ cmListFileBacktrace const& bt)
{
- cmGeneratorExpression ge(entry.Backtrace);
+ cmGeneratorExpression ge(bt);
this->Internal->CompileDefinitionsEntries.push_back(
- new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry.Value)));
+ new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry)));
}
//----------------------------------------------------------------------------
@@ -2959,6 +2970,8 @@ const char *cmTarget::GetProperty(const std::string& prop,
MAKE_STATIC_PROP(COMPILE_DEFINITIONS);
MAKE_STATIC_PROP(IMPORTED);
MAKE_STATIC_PROP(NAME);
+ MAKE_STATIC_PROP(BINARY_DIR);
+ MAKE_STATIC_PROP(SOURCE_DIR);
MAKE_STATIC_PROP(SOURCES);
#undef MAKE_STATIC_PROP
if(specialProps.empty())
@@ -2971,6 +2984,8 @@ const char *cmTarget::GetProperty(const std::string& prop,
specialProps.insert(propCOMPILE_DEFINITIONS);
specialProps.insert(propIMPORTED);
specialProps.insert(propNAME);
+ specialProps.insert(propBINARY_DIR);
+ specialProps.insert(propSOURCE_DIR);
specialProps.insert(propSOURCES);
}
if(specialProps.count(prop))
@@ -3053,6 +3068,14 @@ const char *cmTarget::GetProperty(const std::string& prop,
{
return this->GetName().c_str();
}
+ else if (prop == propBINARY_DIR)
+ {
+ return this->GetMakefile()->GetCurrentBinaryDirectory();
+ }
+ else if (prop == propSOURCE_DIR)
+ {
+ return this->GetMakefile()->GetCurrentSourceDirectory();
+ }
else if(prop == propSOURCES)
{
if (this->Internal->SourceEntries.empty())
@@ -6674,7 +6697,7 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info,
}
std::sort(props.begin(), props.end());
- std::string propsString = cmJoin(cmRange(props).retreat(1), ", ");
+ std::string propsString = cmJoin(cmMakeRange(props).retreat(1), ", ");
propsString += " and the " + props.back();
std::ostringstream e;
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 1920312..f9bcb05 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -572,11 +572,14 @@ public:
std::vector<std::string> GetIncludeDirectories(
const std::string& config,
const std::string& language) const;
- void InsertInclude(const cmValueWithOrigin &entry,
+ void InsertInclude(std::string const& entry,
+ cmListFileBacktrace const& bt,
bool before = false);
- void InsertCompileOption(const cmValueWithOrigin &entry,
- bool before = false);
- void InsertCompileDefinition(const cmValueWithOrigin &entry);
+ void InsertCompileOption(std::string const& entry,
+ cmListFileBacktrace const& bt,
+ bool before = false);
+ void InsertCompileDefinition(std::string const& entry,
+ cmListFileBacktrace const& bt);
void AppendBuildInterfaceIncludes();
diff --git a/Source/cmTargetCompileOptionsCommand.cxx b/Source/cmTargetCompileOptionsCommand.cxx
index a85153d..8e86f0f 100644
--- a/Source/cmTargetCompileOptionsCommand.cxx
+++ b/Source/cmTargetCompileOptionsCommand.cxx
@@ -50,7 +50,6 @@ bool cmTargetCompileOptionsCommand
bool, bool)
{
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
- cmValueWithOrigin entry(this->Join(content), lfbt);
- tgt->InsertCompileOption(entry);
+ tgt->InsertCompileOption(this->Join(content), lfbt);
return true;
}
diff --git a/Source/cmTargetIncludeDirectoriesCommand.cxx b/Source/cmTargetIncludeDirectoriesCommand.cxx
index 24500db..7824c89 100644
--- a/Source/cmTargetIncludeDirectoriesCommand.cxx
+++ b/Source/cmTargetIncludeDirectoriesCommand.cxx
@@ -72,8 +72,7 @@ bool cmTargetIncludeDirectoriesCommand
bool prepend, bool system)
{
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
- cmValueWithOrigin entry(this->Join(content), lfbt);
- tgt->InsertInclude(entry, prepend);
+ tgt->InsertInclude(this->Join(content), lfbt, prepend);
if (system)
{
tgt->AddSystemIncludeDirectories(content);
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 63838b4..71f47f3 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -335,14 +335,14 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
// Echo string
else if (args[1] == "echo" )
{
- std::cout << cmJoin(cmRange(args).advance(2), " ") << std::endl;
+ std::cout << cmJoin(cmMakeRange(args).advance(2), " ") << std::endl;
return 0;
}
// Echo string no new line
else if (args[1] == "echo_append" )
{
- std::cout << cmJoin(cmRange(args).advance(2), " ");
+ std::cout << cmJoin(cmMakeRange(args).advance(2), " ");
return 0;
}
@@ -511,7 +511,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
// Clock command
else if (args[1] == "time" && args.size() > 2)
{
- std::string command = cmJoin(cmRange(args).advance(2), " ");
+ std::string command = cmJoin(cmMakeRange(args).advance(2), " ");
clock_t clock_start, clock_finish;
time_t time_start, time_finish;
@@ -572,7 +572,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
return 1;
}
- std::string command = cmWrap('"', cmRange(args).advance(3), '"', " ");
+ std::string command =
+ cmWrap('"', cmMakeRange(args).advance(3), '"', " ");
int retval = 0;
int timeout = 0;
if ( cmSystemTools::RunSingleCommand(command.c_str(), 0, 0, &retval,
diff --git a/Tests/BuildDepends/CMakeLists.txt b/Tests/BuildDepends/CMakeLists.txt
index 2be59b6..7b7353c 100644
--- a/Tests/BuildDepends/CMakeLists.txt
+++ b/Tests/BuildDepends/CMakeLists.txt
@@ -69,6 +69,9 @@ file(WRITE ${BuildDepends_BINARY_DIR}/Project/link_depends_no_shared_exe.h
"#define link_depends_no_shared_exe_value 0\n")
set(link_depends_no_shared_check_txt ${BuildDepends_BINARY_DIR}/Project/link_depends_no_shared_check.txt)
+file(WRITE ${BuildDepends_BINARY_DIR}/Project/object_depends.txt "0\n")
+set(object_depends_check_txt ${BuildDepends_BINARY_DIR}/Project/object_depends_check.txt)
+
file(WRITE ${BuildDepends_BINARY_DIR}/Project/external.in "external original\n")
file(WRITE ${BuildDepends_BINARY_DIR}/Project/multi1-in.txt "multi1-in original\n")
file(WRITE ${BuildDepends_BINARY_DIR}/Project/multi2-stamp.txt "multi2-stamp original\n")
@@ -246,6 +249,8 @@ file(WRITE ${BuildDepends_BINARY_DIR}/Project/zot_macro_tgt.hxx
file(WRITE ${BuildDepends_BINARY_DIR}/Project/link_depends_no_shared_lib.h
"#define link_depends_no_shared_lib_value 0\n")
+file(WRITE ${BuildDepends_BINARY_DIR}/Project/object_depends.txt "1\n")
+
if(TEST_LINK_DEPENDS)
file(WRITE ${TEST_LINK_DEPENDS} "2")
endif()
@@ -359,6 +364,20 @@ else()
"Targets link_depends_no_shared_lib and link_depends_no_shared_exe not both built.")
endif()
+if(EXISTS "${object_depends_check_txt}")
+ file(STRINGS "${object_depends_check_txt}" object_depends_check LIMIT_COUNT 1)
+ if("${object_depends_check}" STREQUAL "1")
+ message(STATUS "object_depends exe is newer than object_depends.txt as expected.")
+ elseif(CMAKE_GENERATOR MATCHES "Visual Studio|Xcode")
+ message(STATUS "Known limitation: OBJECT_DEPENDS does not work on ${CMAKE_GENERATOR}")
+ else()
+ message(SEND_ERROR "Project did not rebuild properly: object_depends exe is not newer than object_depends.txt.")
+ endif()
+else()
+ message(SEND_ERROR "Project did not rebuild properly. "
+ "object_depends exe and object_depends.txt are not both present.")
+endif()
+
if(EXISTS ${BuildDepends_BINARY_DIR}/Project/external.out)
file(STRINGS ${BuildDepends_BINARY_DIR}/Project/external.out external_out)
if("${external_out}" STREQUAL "external changed")
diff --git a/Tests/BuildDepends/Project/CMakeLists.txt b/Tests/BuildDepends/Project/CMakeLists.txt
index 0db39c5..3aa57fc 100644
--- a/Tests/BuildDepends/Project/CMakeLists.txt
+++ b/Tests/BuildDepends/Project/CMakeLists.txt
@@ -182,3 +182,15 @@ if(TEST_MULTI3)
set_property(SOURCE multi3-real.txt multi3-dummy.txt PROPERTY SYMBOLIC 1)
add_custom_target(multi3 ALL DEPENDS multi3-real.txt)
endif()
+
+add_executable(object_depends object_depends.cxx)
+set_property(SOURCE object_depends.cxx PROPERTY OBJECT_DEPENDS
+ ${CMAKE_CURRENT_BINARY_DIR}/object_depends.txt)
+add_custom_target(object_depends_check ALL
+ COMMAND ${CMAKE_COMMAND}
+ -Dexe=$<TARGET_FILE:object_depends>
+ -Dout=${CMAKE_CURRENT_BINARY_DIR}/object_depends_check.txt
+ -Dtxt=${CMAKE_CURRENT_BINARY_DIR}/object_depends.txt
+ -P ${CMAKE_CURRENT_SOURCE_DIR}/object_depends_check.cmake
+ )
+add_dependencies(object_depends_check object_depends)
diff --git a/Tests/BuildDepends/Project/object_depends.cxx b/Tests/BuildDepends/Project/object_depends.cxx
new file mode 100644
index 0000000..76e8197
--- /dev/null
+++ b/Tests/BuildDepends/Project/object_depends.cxx
@@ -0,0 +1 @@
+int main() { return 0; }
diff --git a/Tests/BuildDepends/Project/object_depends_check.cmake b/Tests/BuildDepends/Project/object_depends_check.cmake
new file mode 100644
index 0000000..e009892
--- /dev/null
+++ b/Tests/BuildDepends/Project/object_depends_check.cmake
@@ -0,0 +1,7 @@
+if(NOT EXISTS "${txt}" OR NOT EXISTS "${exe}")
+ file(REMOVE "${out}")
+elseif("${exe}" IS_NEWER_THAN "${txt}")
+ file(WRITE "${out}" "1\n")
+else()
+ file(WRITE "${out}" "0\n")
+endif()
diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt
index 3ba1e0a..a32138d 100644
--- a/Tests/CompileFeatures/CMakeLists.txt
+++ b/Tests/CompileFeatures/CMakeLists.txt
@@ -116,12 +116,6 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
cxx_deleted_functions
cxx_nonstatic_member_init
)
- else()
- list(REMOVE_ITEM CXX_non_features
- # The cxx_constexpr feature happens to work (for *this* testcase)
- # with VS 2015, but they document only partial support.
- cxx_constexpr
- )
endif()
endif()
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 7ff1889..607e799 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -143,6 +143,7 @@ add_RunCMake_test(Swift)
add_RunCMake_test(TargetObjects)
add_RunCMake_test(TargetSources)
add_RunCMake_test(find_dependency)
+add_RunCMake_test(CompileDefinitions)
add_RunCMake_test(CompileFeatures)
add_RunCMake_test(WriteCompilerDetectionHeader)
if(NOT WIN32)
diff --git a/Tests/RunCMake/CompileDefinitions/CMakeLists.txt b/Tests/RunCMake/CompileDefinitions/CMakeLists.txt
new file mode 100644
index 0000000..74b3ff8
--- /dev/null
+++ b/Tests/RunCMake/CompileDefinitions/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.3)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CompileDefinitions/RunCMakeTest.cmake b/Tests/RunCMake/CompileDefinitions/RunCMakeTest.cmake
new file mode 100644
index 0000000..233fe34
--- /dev/null
+++ b/Tests/RunCMake/CompileDefinitions/RunCMakeTest.cmake
@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake(SetEmpty)
diff --git a/Tests/RunCMake/CompileDefinitions/SetEmpty-result.txt b/Tests/RunCMake/CompileDefinitions/SetEmpty-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CompileDefinitions/SetEmpty-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CompileDefinitions/SetEmpty-stderr.txt b/Tests/RunCMake/CompileDefinitions/SetEmpty-stderr.txt
new file mode 100644
index 0000000..ace6656
--- /dev/null
+++ b/Tests/RunCMake/CompileDefinitions/SetEmpty-stderr.txt
@@ -0,0 +1,3 @@
+RESULT1=A;;B
+RESULT2=
+RESULT3=-DBAR
diff --git a/Tests/RunCMake/CompileDefinitions/SetEmpty.cmake b/Tests/RunCMake/CompileDefinitions/SetEmpty.cmake
new file mode 100644
index 0000000..15cb4e9
--- /dev/null
+++ b/Tests/RunCMake/CompileDefinitions/SetEmpty.cmake
@@ -0,0 +1,12 @@
+
+set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS A "" B)
+get_property(result DIRECTORY PROPERTY COMPILE_DEFINITIONS)
+message("RESULT1=${result}")
+
+set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS)
+get_property(result DIRECTORY PROPERTY COMPILE_DEFINITIONS)
+message("RESULT2=${result}")
+
+set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS -DBAR)
+get_property(result DIRECTORY PROPERTY COMPILE_DEFINITIONS)
+message("RESULT3=${result}")
diff --git a/Tests/RunCMake/export/AppendExport-stderr.txt b/Tests/RunCMake/export/AppendExport-stderr.txt
index 6e385d4..d71620e 100644
--- a/Tests/RunCMake/export/AppendExport-stderr.txt
+++ b/Tests/RunCMake/export/AppendExport-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at AppendExport.cmake:8 \(export\):
+CMake Error at AppendExport.cmake:[0-9]+ \(export\):
export EXPORT signature does not recognise the APPEND option.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/export/AppendExport.cmake b/Tests/RunCMake/export/AppendExport.cmake
index f36010b..2a99dfc 100644
--- a/Tests/RunCMake/export/AppendExport.cmake
+++ b/Tests/RunCMake/export/AppendExport.cmake
@@ -1,3 +1,4 @@
+enable_language(CXX)
add_library(foo empty.cpp)
export(TARGETS foo FILE "${CMAKE_CURRENT_BINARY_DIR}/foo.cmake")
install(TARGETS foo EXPORT fooExport
diff --git a/Tests/RunCMake/export/CMakeLists.txt b/Tests/RunCMake/export/CMakeLists.txt
index be9d403..12cd3c7 100644
--- a/Tests/RunCMake/export/CMakeLists.txt
+++ b/Tests/RunCMake/export/CMakeLists.txt
@@ -1,3 +1,3 @@
cmake_minimum_required(VERSION 2.8.4)
-project(${RunCMake_TEST})
+project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/export/CustomTarget-result.txt b/Tests/RunCMake/export/CustomTarget-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/export/CustomTarget-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/export/CustomTarget-stderr.txt b/Tests/RunCMake/export/CustomTarget-stderr.txt
new file mode 100644
index 0000000..57a9af3
--- /dev/null
+++ b/Tests/RunCMake/export/CustomTarget-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at CustomTarget.cmake:[0-9]+ \(export\):
+ export given custom target "CustomTarget" which may not be exported.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/export/CustomTarget.cmake b/Tests/RunCMake/export/CustomTarget.cmake
new file mode 100644
index 0000000..4d2bf18
--- /dev/null
+++ b/Tests/RunCMake/export/CustomTarget.cmake
@@ -0,0 +1,2 @@
+add_custom_target(CustomTarget)
+export(TARGETS CustomTarget FILE somefile.cmake)
diff --git a/Tests/RunCMake/export/OldIface-stderr.txt b/Tests/RunCMake/export/OldIface-stderr.txt
index afb4ae3..818c2cb 100644
--- a/Tests/RunCMake/export/OldIface-stderr.txt
+++ b/Tests/RunCMake/export/OldIface-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at OldIface.cmake:8 \(export\):
+CMake Error at OldIface.cmake:[0-9]+ \(export\):
export EXPORT signature does not recognise the
EXPORT_LINK_INTERFACE_LIBRARIES option.
Call Stack \(most recent call first\):
diff --git a/Tests/RunCMake/export/OldIface.cmake b/Tests/RunCMake/export/OldIface.cmake
index 5fb8e25..833b023 100644
--- a/Tests/RunCMake/export/OldIface.cmake
+++ b/Tests/RunCMake/export/OldIface.cmake
@@ -1,3 +1,4 @@
+enable_language(CXX)
add_library(foo empty.cpp)
export(TARGETS foo FILE "${CMAKE_CURRENT_BINARY_DIR}/foo.cmake")
install(TARGETS foo EXPORT fooExport
diff --git a/Tests/RunCMake/export/RunCMakeTest.cmake b/Tests/RunCMake/export/RunCMakeTest.cmake
index 4b04f18..6d0b7ca 100644
--- a/Tests/RunCMake/export/RunCMakeTest.cmake
+++ b/Tests/RunCMake/export/RunCMakeTest.cmake
@@ -1,5 +1,6 @@
include(RunCMake)
+run_cmake(CustomTarget)
run_cmake(TargetNotFound)
run_cmake(AppendExport)
run_cmake(OldIface)
diff --git a/Tests/RunCMake/get_property/target_properties-stderr.txt b/Tests/RunCMake/get_property/target_properties-stderr.txt
index d0981ac..6b3c6ca 100644
--- a/Tests/RunCMake/get_property/target_properties-stderr.txt
+++ b/Tests/RunCMake/get_property/target_properties-stderr.txt
@@ -3,4 +3,8 @@ get_property: --><--
get_target_property: -->value<--
get_property: -->value<--
get_target_property: -->gtp_val-NOTFOUND<--
-get_property: --><--$
+get_property: --><--
+get_target_property: -->(.*)/Tests/RunCMake/get_property<--
+get_property: -->(.*)/Tests/RunCMake/get_property<--
+get_target_property: -->(.*)/Tests/RunCMake/get_property/target_properties-build<--
+get_property: -->(.*)/Tests/RunCMake/get_property/target_properties-build<--$
diff --git a/Tests/RunCMake/get_property/target_properties.cmake b/Tests/RunCMake/get_property/target_properties.cmake
index c5a141d..9ff833a 100644
--- a/Tests/RunCMake/get_property/target_properties.cmake
+++ b/Tests/RunCMake/get_property/target_properties.cmake
@@ -14,3 +14,5 @@ set_target_properties(tgt PROPERTIES empty "" custom value)
check_target_property(tgt empty)
check_target_property(tgt custom)
check_target_property(tgt noexist)
+check_target_property(tgt SOURCE_DIR)
+check_target_property(tgt BINARY_DIR)
diff --git a/Utilities/Release/create-cmake-release.cmake b/Utilities/Release/create-cmake-release.cmake
index 19f4cb1..4b93e6e 100644
--- a/Utilities/Release/create-cmake-release.cmake
+++ b/Utilities/Release/create-cmake-release.cmake
@@ -11,7 +11,6 @@ set(RELEASE_SCRIPTS_BATCH_1
dashmacmini5_release.cmake # Mac Darwin64 universal x86_64;i386
magrathea_release.cmake # Linux
linux64_release.cmake # Linux x86_64
- ibm_aix_release.cmake # AIX
)
set(RELEASE_SCRIPTS_BATCH_2
diff --git a/Utilities/Release/ibm_aix_release.cmake b/Utilities/Release/ibm_aix_release.cmake
deleted file mode 100644
index 5a6efe6..0000000
--- a/Utilities/Release/ibm_aix_release.cmake
+++ /dev/null
@@ -1,15 +0,0 @@
-set(CMAKE_RELEASE_DIRECTORY "/bench1/noibm34/CMakeReleaseDirectory")
-set(PROCESSORS 64)
-set(HOST "ibm-backend")
-set(SCRIPT_NAME aix)
-set(MAKE_PROGRAM "make")
-set(CC "xlc_r")
-set(CXX "xlC_r")
-set(FC "xlf")
-set(LDFLAGS "-Wl,-bmaxdata:0x80000000") # Push "Segmentation fault in extend_brk" over horizon
-set(INITIAL_CACHE "
-CMAKE_BUILD_TYPE:STRING=Release
-CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE
-")
-get_filename_component(path "${CMAKE_CURRENT_LIST_FILE}" PATH)
-include(${path}/release_cmake.cmake)