[Cmake-commits] CMake branch, next, updated. v3.0.0-rc2-1304-gf629b06
Stephen Kelly
steveire at gmail.com
Thu Mar 20 10:54:22 EDT 2014
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via f629b06cb3ecc1d6dc8a52f20adefb7ac0b1103a (commit)
via 78764e7d17a158d85037fa5d5e45c0061458f917 (commit)
from c97c540090e8b93a9fe4f39dd3826b62f4d8a34f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f629b06cb3ecc1d6dc8a52f20adefb7ac0b1103a
commit f629b06cb3ecc1d6dc8a52f20adefb7ac0b1103a
Merge: c97c540 78764e7
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Mar 20 10:54:21 2014 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Mar 20 10:54:21 2014 -0400
Merge topic 'target-sources-refactor' into next
78764e7d Genex: Only evaluate TARGET_OBJECTS to determine target sources.
diff --cc Source/cmGeneratorExpression.h
index d1eca25,fbb216d..cc46732
--- a/Source/cmGeneratorExpression.h
+++ b/Source/cmGeneratorExpression.h
@@@ -132,9 -136,9 +137,10 @@@ private
mutable std::set<cmTarget*> DependTargets;
mutable std::set<cmTarget const*> AllTargetsSeen;
mutable std::set<std::string> SeenTargetProperties;
+ mutable std::set<std::string> SeenCompileNonFeatures;
mutable std::string Output;
mutable bool HadContextSensitiveCondition;
+ bool EvaluateForBuildsystem;
};
#endif
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=78764e7d17a158d85037fa5d5e45c0061458f917
commit 78764e7d17a158d85037fa5d5e45c0061458f917
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Mar 20 15:37:12 2014 +0100
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Mar 20 15:50:01 2014 +0100
Genex: Only evaluate TARGET_OBJECTS to determine target sources.
The output of this expression may contain macros for IDEs to replace
such as $(Configuration), $(CURRENT_ARCH) etc. To avoid generating
content which is not usable in other contexts, report an error if
there is an attempt to use it in other contexts.
This commit may be reverted in the future if a solution to the
above difference is implemented.
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index 17263d4..dfda8dc 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -190,4 +190,6 @@ property is non-empty::
Content of ``...`` converted to a C identifier.
``$<TARGET_OBJECTS:objLib>``
List of objects resulting from build of ``objLib``. ``objLib`` must be an
- object of type ``OBJECT_LIBRARY``.
+ object of type ``OBJECT_LIBRARY``. This expression may only be used in
+ the sources of :command:`add_library` and :command:`add_executable`
+ commands.
diff --git a/Help/release/dev/file-GENERATE-TARGET_OBJECTS.rst b/Help/release/dev/file-GENERATE-TARGET_OBJECTS.rst
deleted file mode 100644
index 853a803..0000000
--- a/Help/release/dev/file-GENERATE-TARGET_OBJECTS.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-file-GENERATE-TARGET_OBJECTS
-----------------------------
-
-* The :command:`file(GENERATE)` subcommand learned to evaluate the
- ``TARGET_OBJECTS``
- :manual:`generator expression <cmake-generator-expressions(7)>`.
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index e127f3a..d09e950 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -90,6 +90,7 @@ const char *cmCompiledGeneratorExpression::Evaluate(
context.HadError = false;
context.HadContextSensitiveCondition = false;
context.HeadTarget = headTarget;
+ context.EvaluateForBuildsystem = this->EvaluateForBuildsystem;
context.CurrentTarget = currentTarget ? currentTarget : headTarget;
context.Backtrace = this->Backtrace;
@@ -124,7 +125,8 @@ cmCompiledGeneratorExpression::cmCompiledGeneratorExpression(
cmListFileBacktrace const& backtrace,
const std::string& input)
: Backtrace(backtrace), Input(input),
- HadContextSensitiveCondition(false)
+ HadContextSensitiveCondition(false),
+ EvaluateForBuildsystem(false)
{
cmGeneratorExpressionLexer l;
std::vector<cmGeneratorExpressionToken> tokens =
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h
index 5b97e8b..fbb216d 100644
--- a/Source/cmGeneratorExpression.h
+++ b/Source/cmGeneratorExpression.h
@@ -114,6 +114,11 @@ public:
return this->HadContextSensitiveCondition;
}
+ void SetEvaluateForBuildsystem(bool eval)
+ {
+ this->EvaluateForBuildsystem = eval;
+ }
+
private:
cmCompiledGeneratorExpression(cmListFileBacktrace const& backtrace,
const std::string& input);
@@ -133,6 +138,7 @@ private:
mutable std::set<std::string> SeenTargetProperties;
mutable std::string Output;
mutable bool HadContextSensitiveCondition;
+ bool EvaluateForBuildsystem;
};
#endif
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index 669694c..b90d094 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -1251,6 +1251,16 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode
const GeneratorExpressionContent *content,
cmGeneratorExpressionDAGChecker *) const
{
+ if (!context->EvaluateForBuildsystem)
+ {
+ cmOStringStream e;
+ e << "The TARGET_OBJECTS generator expression may only be evaluated "
+ "by cmake itself. It may not be evaluated by file(GENERATE), "
+ "install(FILES) etc.";
+ reportError(context, content->GetOriginalExpression(), e.str());
+ return std::string();
+ }
+
std::string tgtName = parameters.front();
cmGeneratorTarget* gt =
context->Makefile->FindGeneratorTargetToUse(tgtName.c_str());
diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h
index a7099cb..54a2548 100644
--- a/Source/cmGeneratorExpressionEvaluator.h
+++ b/Source/cmGeneratorExpressionEvaluator.h
@@ -34,6 +34,7 @@ struct cmGeneratorExpressionContext
bool Quiet;
bool HadError;
bool HadContextSensitiveCondition;
+ bool EvaluateForBuildsystem;
};
struct cmGeneratorExpressionDAGChecker;
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 61260be..aeb477d 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -732,6 +732,7 @@ cmSourceFile* cmTarget::AddSource(const std::string& src)
this->Makefile->GetBacktrace(lfbt);
cmGeneratorExpression ge(lfbt);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(src);
+ cge->SetEvaluateForBuildsystem(true);
this->Internal->SourceEntries.push_back(
new cmTargetInternals::TargetPropertyEntry(cge));
}
diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt
index b506853..758165c 100644
--- a/Tests/GeneratorExpression/CMakeLists.txt
+++ b/Tests/GeneratorExpression/CMakeLists.txt
@@ -258,17 +258,3 @@ set(CMP0044_TYPE NEW)
add_subdirectory(CMP0044 ${CMAKE_BINARY_DIR}/CMP0044-NEW)
set(CMP0044_TYPE OLD)
add_subdirectory(CMP0044 ${CMAKE_BINARY_DIR}/CMP0044-OLD)
-
-add_library(objlib OBJECT objlib1.c objlib2.c)
-file(GENERATE
- OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/objlib_files"
- CONTENT "$<JOIN:$<TARGET_OBJECTS:objlib>,\n>\n"
-)
-add_custom_target(check_object_files ALL
- COMMAND ${CMAKE_COMMAND}
- "-DOBJLIB_LISTFILE=${CMAKE_CURRENT_BINARY_DIR}/objlib_files"
- -DTEST_CONFIGURATION=${CMAKE_BUILD_TYPE}
- -DEXPECTED_NUM_OBJECTFILES=2
- -P "${CMAKE_CURRENT_SOURCE_DIR}/check_object_files.cmake"
- DEPENDS objlib
-)
diff --git a/Tests/GeneratorExpression/check_object_files.cmake b/Tests/GeneratorExpression/check_object_files.cmake
deleted file mode 100644
index 889fe80..0000000
--- a/Tests/GeneratorExpression/check_object_files.cmake
+++ /dev/null
@@ -1,48 +0,0 @@
-
-if (NOT EXISTS ${OBJLIB_LISTFILE})
- message(SEND_ERROR "Object listing file \"${OBJLIB_LISTFILE}\" not found!")
-endif()
-
-file(STRINGS ${OBJLIB_LISTFILE} objlib_files)
-
-list(LENGTH objlib_files num_objectfiles)
-if (NOT EXPECTED_NUM_OBJECTFILES EQUAL num_objectfiles)
- message(SEND_ERROR "Unexpected number of entries in object list file (${num_objectfiles} instead of ${EXPECTED_NUM_OBJECTFILES})")
-endif()
-
-foreach(objlib_file ${objlib_files})
- set(file_exists False)
- if (EXISTS ${objlib_file})
- set(file_exists True)
- endif()
-
- if (NOT file_exists)
- if (objlib_file MATCHES ".(CURRENT_ARCH)")
- string(REPLACE "$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)" "*" config_file "${objlib_file}")
- string(REPLACE "$(PROJECT_NAME)" "GeneratorExpression" config_file "${config_file}")
- string(REPLACE "$(CURRENT_ARCH)" "*" config_file "${config_file}")
- file(GLOB_RECURSE files "${config_file}")
- list(LENGTH files num_files)
- if (NOT files)
- message(SEND_ERROR "Got no files for expression ${config_file}")
- endif()
- set(file_exists True)
- else()
- foreach(config_macro "$(Configuration)" "$(OutDir)" "$(IntDir)")
- string(REPLACE "${config_macro}" "${TEST_CONFIGURATION}" config_file "${objlib_file}")
- list(APPEND attempts ${config_file})
- if (EXISTS ${config_file})
- set(file_exists True)
- endif()
- endforeach()
- endif()
- endif()
-
- if (NOT file_exists)
- if(attempts)
- list(REMOVE_DUPLICATES attempts)
- set(tried " Tried ${attempts}")
- endif()
- message(SEND_ERROR "File \"${objlib_file}\" does not exist!${tried}")
- endif()
-endforeach()
diff --git a/Tests/GeneratorExpression/objlib1.c b/Tests/GeneratorExpression/objlib1.c
deleted file mode 100644
index aa8de0a..0000000
--- a/Tests/GeneratorExpression/objlib1.c
+++ /dev/null
@@ -1,5 +0,0 @@
-
-void objlib1()
-{
-
-}
diff --git a/Tests/GeneratorExpression/objlib2.c b/Tests/GeneratorExpression/objlib2.c
deleted file mode 100644
index 3c7307a..0000000
--- a/Tests/GeneratorExpression/objlib2.c
+++ /dev/null
@@ -1,5 +0,0 @@
-
-void objlib2()
-{
-
-}
diff --git a/Tests/RunCMake/TargetObjects/NoTarget-result.txt b/Tests/RunCMake/TargetObjects/BadContext-result.txt
similarity index 100%
rename from Tests/RunCMake/TargetObjects/NoTarget-result.txt
rename to Tests/RunCMake/TargetObjects/BadContext-result.txt
diff --git a/Tests/RunCMake/TargetObjects/BadContext-stderr.txt b/Tests/RunCMake/TargetObjects/BadContext-stderr.txt
new file mode 100644
index 0000000..4d28c8e
--- /dev/null
+++ b/Tests/RunCMake/TargetObjects/BadContext-stderr.txt
@@ -0,0 +1,17 @@
+CMake Error at BadContext.cmake:2 \(file\):
+ Error evaluating generator expression:
+
+ \$<TARGET_OBJECTS:NoTarget>
+
+ The TARGET_OBJECTS generator expression may only be evaluated by cmake
+ itself. It may not be evaluated by file\(GENERATE\), install\(FILES\) etc.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error:
+ Error evaluating generator expression:
+
+ \$<TARGET_OBJECTS:NoTarget>
+
+ The TARGET_OBJECTS generator expression may only be evaluated by cmake
+ itself. It may not be evaluated by file\(GENERATE\), install\(FILES\) etc.
diff --git a/Tests/RunCMake/TargetObjects/NoTarget.cmake b/Tests/RunCMake/TargetObjects/BadContext.cmake
similarity index 52%
rename from Tests/RunCMake/TargetObjects/NoTarget.cmake
rename to Tests/RunCMake/TargetObjects/BadContext.cmake
index f203c23..67962a4 100644
--- a/Tests/RunCMake/TargetObjects/NoTarget.cmake
+++ b/Tests/RunCMake/TargetObjects/BadContext.cmake
@@ -1,2 +1,4 @@
file(GENERATE OUTPUT test_output CONTENT $<TARGET_OBJECTS:NoTarget>)
+
+install(FILES $<TARGET_OBJECTS:NoTarget> DESTINATION objects)
diff --git a/Tests/RunCMake/TargetObjects/NoTarget-stderr.txt b/Tests/RunCMake/TargetObjects/NoTarget-stderr.txt
deleted file mode 100644
index 2c4f877..0000000
--- a/Tests/RunCMake/TargetObjects/NoTarget-stderr.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-CMake Error at NoTarget.cmake:2 \(file\):
- Error evaluating generator expression:
-
- \$<TARGET_OBJECTS:NoTarget>
-
- Objects of target "NoTarget" referenced but no such target exists.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/TargetObjects/NotObjlibTarget-result.txt b/Tests/RunCMake/TargetObjects/NotObjlibTarget-result.txt
deleted file mode 100644
index d00491f..0000000
--- a/Tests/RunCMake/TargetObjects/NotObjlibTarget-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-1
diff --git a/Tests/RunCMake/TargetObjects/NotObjlibTarget-stderr.txt b/Tests/RunCMake/TargetObjects/NotObjlibTarget-stderr.txt
deleted file mode 100644
index bb83934..0000000
--- a/Tests/RunCMake/TargetObjects/NotObjlibTarget-stderr.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-CMake Error at NotObjlibTarget.cmake:4 \(file\):
- Error evaluating generator expression:
-
- \$<TARGET_OBJECTS:StaticLib>
-
- Objects of target "StaticLib" referenced but is not an OBJECT library.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/TargetObjects/NotObjlibTarget.cmake b/Tests/RunCMake/TargetObjects/NotObjlibTarget.cmake
deleted file mode 100644
index c7f8a71..0000000
--- a/Tests/RunCMake/TargetObjects/NotObjlibTarget.cmake
+++ /dev/null
@@ -1,4 +0,0 @@
-
-add_library(StaticLib empty.cpp)
-
-file(GENERATE OUTPUT test_output CONTENT $<TARGET_OBJECTS:StaticLib>)
diff --git a/Tests/RunCMake/TargetObjects/RunCMakeTest.cmake b/Tests/RunCMake/TargetObjects/RunCMakeTest.cmake
index 30b9fee..85c76e2 100644
--- a/Tests/RunCMake/TargetObjects/RunCMakeTest.cmake
+++ b/Tests/RunCMake/TargetObjects/RunCMakeTest.cmake
@@ -1,4 +1,3 @@
include(RunCMake)
-run_cmake(NoTarget)
-run_cmake(NotObjlibTarget)
+run_cmake(BadContext)
diff --git a/Tests/RunCMake/TargetObjects/empty.cpp b/Tests/RunCMake/TargetObjects/empty.cpp
deleted file mode 100644
index bfbbdde..0000000
--- a/Tests/RunCMake/TargetObjects/empty.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifdef _WIN32
-__declspec(dllexport)
-#endif
-int empty()
-{
- return 0;
-}
-----------------------------------------------------------------------
Summary of changes:
Help/manual/cmake-generator-expressions.7.rst | 4 +-
Help/release/dev/file-GENERATE-TARGET_OBJECTS.rst | 6 ---
Source/cmGeneratorExpression.cxx | 4 +-
Source/cmGeneratorExpression.h | 6 +++
Source/cmGeneratorExpressionEvaluator.cxx | 10 ++++
Source/cmGeneratorExpressionEvaluator.h | 1 +
Source/cmTarget.cxx | 1 +
Tests/GeneratorExpression/CMakeLists.txt | 14 ------
Tests/GeneratorExpression/check_object_files.cmake | 48 --------------------
Tests/GeneratorExpression/objlib1.c | 5 --
Tests/GeneratorExpression/objlib2.c | 5 --
.../BadContext-result.txt} | 0
Tests/RunCMake/TargetObjects/BadContext-stderr.txt | 17 +++++++
.../{NoTarget.cmake => BadContext.cmake} | 2 +
Tests/RunCMake/TargetObjects/NoTarget-result.txt | 1 -
Tests/RunCMake/TargetObjects/NoTarget-stderr.txt | 8 ----
.../TargetObjects/NotObjlibTarget-result.txt | 1 -
.../TargetObjects/NotObjlibTarget-stderr.txt | 8 ----
Tests/RunCMake/TargetObjects/NotObjlibTarget.cmake | 4 --
Tests/RunCMake/TargetObjects/RunCMakeTest.cmake | 3 +-
Tests/RunCMake/TargetObjects/empty.cpp | 7 ---
21 files changed, 44 insertions(+), 111 deletions(-)
delete mode 100644 Help/release/dev/file-GENERATE-TARGET_OBJECTS.rst
delete mode 100644 Tests/GeneratorExpression/check_object_files.cmake
delete mode 100644 Tests/GeneratorExpression/objlib1.c
delete mode 100644 Tests/GeneratorExpression/objlib2.c
copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => TargetObjects/BadContext-result.txt} (100%)
create mode 100644 Tests/RunCMake/TargetObjects/BadContext-stderr.txt
rename Tests/RunCMake/TargetObjects/{NoTarget.cmake => BadContext.cmake} (52%)
delete mode 100644 Tests/RunCMake/TargetObjects/NoTarget-result.txt
delete mode 100644 Tests/RunCMake/TargetObjects/NoTarget-stderr.txt
delete mode 100644 Tests/RunCMake/TargetObjects/NotObjlibTarget-result.txt
delete mode 100644 Tests/RunCMake/TargetObjects/NotObjlibTarget-stderr.txt
delete mode 100644 Tests/RunCMake/TargetObjects/NotObjlibTarget.cmake
delete mode 100644 Tests/RunCMake/TargetObjects/empty.cpp
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list