[Cmake-commits] CMake branch, next, updated. v2.8.11.2-4014-geade9b1

Stephen Kelly steveire at gmail.com
Tue Aug 27 18:52:11 EDT 2013


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  eade9b1e6c57c34de744f9b9c380c8348a3be87f (commit)
       via  d26594f39073ce08eaa0ebab2f85d09c8673668c (commit)
      from  a44800c084ce56567b1951c3d50675808d8a5bb6 (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=eade9b1e6c57c34de744f9b9c380c8348a3be87f
commit eade9b1e6c57c34de744f9b9c380c8348a3be87f
Merge: a44800c d26594f
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Aug 27 18:52:09 2013 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Aug 27 18:52:09 2013 -0400

    Merge topic 'ADDITIONAL_MAKE_CLEAN_FILES-genex' into next
    
    d26594f Genex: Evaluate genexes for additional make clean files.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d26594f39073ce08eaa0ebab2f85d09c8673668c
commit d26594f39073ce08eaa0ebab2f85d09c8673668c
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Aug 28 00:20:29 2013 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Aug 28 00:49:29 2013 +0200

    Genex: Evaluate genexes for additional make clean files.
    
    This is necessary because custom commands and targets may create
    custom files whose names are determined by generator expressions.
    
    For example, clang should be using $<TARGET_FILE> and $<TARGET_FILE_DIR>
    instead of reverse engineering the output file name:
    
     http://thread.gmane.org/gmane.comp.compilers.clang.scm/80523
    
    However, that can only be done when ADDITIONAL_MAKE_CLEAN_FILES
    also accepts and evaluates generator expressions.
    
    Similarly, KDE uses the LOCATION property where $<TARGET_FILE>
    would also be better in KDE4_HANDLE_RPATH_FOR_EXECUTABLE but
    also appends the result to ADDITIONAL_MAKE_CLEAN_FILES.
    
    After this patch, both can be ported to generator expressions.

diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 0829cab..4e40f6c 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -21,6 +21,7 @@
 #include "cmTarget.h"
 #include "cmake.h"
 #include "cmComputeLinkInformation.h"
+#include "cmGeneratorExpression.h"
 
 #include "cmMakefileExecutableTargetGenerator.h"
 #include "cmMakefileLibraryTargetGenerator.h"
@@ -131,7 +132,14 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
      this->Makefile->GetProperty
      ("ADDITIONAL_MAKE_CLEAN_FILES"))
     {
-    cmSystemTools::ExpandListArgument(additional_clean_files,
+    const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE");
+    cmListFileBacktrace lfbt;
+    cmGeneratorExpression ge(lfbt);
+    cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
+                                            ge.Parse(additional_clean_files);
+
+    cmSystemTools::ExpandListArgument(cge->Evaluate(this->Makefile, config,
+                                                  false, this->Target, 0, 0),
                                       this->CleanFiles);
     }
 
diff --git a/Tests/MakeClean/ToClean/CMakeLists.txt b/Tests/MakeClean/ToClean/CMakeLists.txt
index 28569dd..37d7292 100644
--- a/Tests/MakeClean/ToClean/CMakeLists.txt
+++ b/Tests/MakeClean/ToClean/CMakeLists.txt
@@ -26,6 +26,18 @@ add_custom_command(OUTPUT ${ToClean_BINARY_DIR}/generated.txt
 add_custom_target(generate ALL DEPENDS ${ToClean_BINARY_DIR}/generated.txt)
 set(TOCLEAN_FILES ${TOCLEAN_FILES} "${ToClean_BINARY_DIR}/generated.txt")
 
+# Create a custom command whose output should be cleaned, but whose name
+# is not known until generate-time
+set(copied_exe "$<TARGET_FILE_DIR:toclean>/toclean_copy${CMAKE_EXECUTABLE_SUFFIX}")
+add_custom_command(TARGET toclean POST_BUILD
+  COMMAND ${CMAKE_COMMAND}
+  ARGS -E copy $<TARGET_FILE:toclean>
+               ${copied_exe}
+  )
+set_property(DIRECTORY APPEND PROPERTY
+  ADDITIONAL_MAKE_CLEAN_FILES ${copied_exe})
+list(APPEND TOCLEAN_FILES "${ToClean_BINARY_DIR}/toclean_copy${CMAKE_EXECUTABLE_SUFFIX}")
+
 # Configure a file listing these build-time-generated files.
 configure_file(${ToClean_SOURCE_DIR}/ToCleanFiles.cmake.in
                ${ToClean_BINARY_DIR}/ToCleanFiles.cmake @ONLY IMMEDIATE)

-----------------------------------------------------------------------

Summary of changes:
 Source/cmMakefileTargetGenerator.cxx   |   10 +++++++++-
 Tests/MakeClean/ToClean/CMakeLists.txt |   12 ++++++++++++
 2 files changed, 21 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list