[Cmake-commits] CMake branch, next, updated. v2.8.3-806-gc9c1272

Marcus D. Hanwell marcus.hanwell at kitware.com
Sat Dec 11 12:13:20 EST 2010


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  c9c1272a165b5e7f081746b975881b404d888586 (commit)
       via  b316087c095e23e131bf2ccf5eb7110b35df0e29 (commit)
       via  68cd3fe038471b5a60d396eac141a69414b3064d (commit)
      from  9323fedf89a7bac078c684220e47c237fba360cd (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=c9c1272a165b5e7f081746b975881b404d888586
commit c9c1272a165b5e7f081746b975881b404d888586
Merge: 9323fed b316087
Author:     Marcus D. Hanwell <marcus.hanwell at kitware.com>
AuthorDate: Sat Dec 11 12:13:18 2010 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Sat Dec 11 12:13:18 2010 -0500

    Merge topic 'external-project-args-file' into next
    
    b316087 Escape file write expansion, and build up lists.
    68cd3fe Added CMAKE_CACHE_ARGS to ExternalProject.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b316087c095e23e131bf2ccf5eb7110b35df0e29
commit b316087c095e23e131bf2ccf5eb7110b35df0e29
Author:     Marcus D. Hanwell <marcus.hanwell at kitware.com>
AuthorDate: Fri Dec 10 20:03:58 2010 -0500
Commit:     Marcus D. Hanwell <marcus.hanwell at kitware.com>
CommitDate: Sat Dec 11 12:11:27 2010 -0500

    Escape file write expansion, and build up lists.
    
    Escaped the @var@ in the file writes - this was being expanded at file
    write and so not causing a reconfigure at the right time. I also took
    care of build up lists of lists in the variables, especially important
    for things like MPI_EXTRA_LIBRARY. Added some error checking, and use
    the tmp_dir for initial cache file.

diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index c575a73..542dbc2 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -554,23 +554,36 @@ function(_ep_write_initial_cache script_filename args)
   # Write out values into an initial cache, that will be passed to CMake with -C
   set(script_initial_cache "")
   set(regex "^([^:]+):([^=]+)=(.*)$")
+  set(setArg "")
   foreach(line ${args})
-    string(REGEX REPLACE "^-D" "" line ${line})
-    if("${line}" MATCHES "${regex}")
-      string(REGEX MATCH "${regex}" match "${line}")
-      set(name "${CMAKE_MATCH_1}")
-      set(type "${CMAKE_MATCH_2}")
-      set(value "${CMAKE_MATCH_3}")
-      set(setArg "set(${name} \"${value}\" CACHE ${type} \"Initial cache\" FORCE)")
-      set(script_initial_cache "${script_initial_cache}\n${setArg}")
+    if("${line}" MATCHES "^-D")
+      if(setArg)
+        # This is required to build up lists in variables, or complete an entry
+        set(setArg "${setArg}${accumulator}\" CACHE ${type} \"Initial cache\" FORCE)")
+        set(script_initial_cache "${script_initial_cache}\n${setArg}")
+        set(accumulator "")
+        set(setArg "")
+      endif()
+      string(REGEX REPLACE "^-D" "" line ${line})
+      if("${line}" MATCHES "${regex}")
+        string(REGEX MATCH "${regex}" match "${line}")
+        set(name "${CMAKE_MATCH_1}")
+        set(type "${CMAKE_MATCH_2}")
+        set(value "${CMAKE_MATCH_3}")
+        set(setArg "set(${name} \"${value}")
+      else()
+        message(WARNING "Line '${line}' does not match regex. Ignoring.")
+      endif()
+    else()
+      # Assume this is a list to append to the last var
+      set(accumulator "${accumulator};${line}")
     endif()
   endforeach()
   # Write out the initial cache file to the location specified.
   if(NOT EXISTS "${script_filename}.in")
-    file(WRITE "${script_filename}.in" "@script_initial_cache@\n")
+    file(WRITE "${script_filename}.in" "\@script_initial_cache\@\n")
   endif()
   configure_file("${script_filename}.in" "${script_filename}")
-
 endfunction(_ep_write_initial_cache)
 
 
@@ -1251,7 +1264,7 @@ function(_ep_add_configure_command name)
     # If there are any CMAKE_CACHE_ARGS, write an initial cache and use it
     get_property(cmake_cache_args TARGET ${name} PROPERTY _EP_CMAKE_CACHE_ARGS)
     if(cmake_cache_args)
-      set(_ep_cache_args_script "${CMAKE_CURRENT_BINARY_DIR}/${name}-cache.cmake")
+      set(_ep_cache_args_script "${tmp_dir}/${name}-cache.cmake")
       _ep_write_initial_cache("${_ep_cache_args_script}" "${cmake_cache_args}")
       list(APPEND cmd "-C${_ep_cache_args_script}")
     endif()
@@ -1274,7 +1287,7 @@ function(_ep_add_configure_command name)
   # Fixes issue http://public.kitware.com/Bug/view.php?id=10258
   #
   if(NOT EXISTS ${tmp_dir}/${name}-cfgcmd.txt.in)
-    file(WRITE ${tmp_dir}/${name}-cfgcmd.txt.in "cmd='@cmd@'\n")
+    file(WRITE ${tmp_dir}/${name}-cfgcmd.txt.in "cmd='\@cmd\@'\n")
   endif()
   configure_file(${tmp_dir}/${name}-cfgcmd.txt.in ${tmp_dir}/${name}-cfgcmd.txt)
   list(APPEND file_deps ${tmp_dir}/${name}-cfgcmd.txt)

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=68cd3fe038471b5a60d396eac141a69414b3064d
commit 68cd3fe038471b5a60d396eac141a69414b3064d
Author:     Marcus D. Hanwell <marcus.hanwell at kitware.com>
AuthorDate: Fri Dec 10 17:41:41 2010 -0500
Commit:     Marcus D. Hanwell <marcus.hanwell at kitware.com>
CommitDate: Fri Dec 10 17:41:41 2010 -0500

    Added CMAKE_CACHE_ARGS to ExternalProject.
    
    On Windows the limit for command line arguments is 8192 characters, and
    this was limiting longer paths with some of our more nested projects
    such as Library. Placing the -D arguments into CMAKE_CACHE_ARGS will
    write out an initial cache file, that will be passed to CMake with a -C
    argument as the initial cache.
    
    By forcing the cache variables we preserve the existing behavior with
    -D, to change the values of cache variables in our inner projects.

diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 1be6cfd..c575a73 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -32,6 +32,7 @@
 #    [CMAKE_COMMAND /.../cmake]  # Specify alternative cmake executable
 #    [CMAKE_GENERATOR gen]       # Specify generator for native build
 #    [CMAKE_ARGS args...]        # Arguments to CMake command line
+#    [CMAKE_CACHE_ARGS args...]  # Initial cache arguments, of the form -Dvar:string=on
 #   #--Build step-----------------
 #    [BINARY_DIR dir]            # Specify build dir location
 #    [BUILD_COMMAND cmd...]      # Command to drive the native build
@@ -549,6 +550,29 @@ function(_ep_set_directories name)
   endforeach()
 endfunction(_ep_set_directories)
 
+function(_ep_write_initial_cache script_filename args)
+  # Write out values into an initial cache, that will be passed to CMake with -C
+  set(script_initial_cache "")
+  set(regex "^([^:]+):([^=]+)=(.*)$")
+  foreach(line ${args})
+    string(REGEX REPLACE "^-D" "" line ${line})
+    if("${line}" MATCHES "${regex}")
+      string(REGEX MATCH "${regex}" match "${line}")
+      set(name "${CMAKE_MATCH_1}")
+      set(type "${CMAKE_MATCH_2}")
+      set(value "${CMAKE_MATCH_3}")
+      set(setArg "set(${name} \"${value}\" CACHE ${type} \"Initial cache\" FORCE)")
+      set(script_initial_cache "${script_initial_cache}\n${setArg}")
+    endif()
+  endforeach()
+  # Write out the initial cache file to the location specified.
+  if(NOT EXISTS "${script_filename}.in")
+    file(WRITE "${script_filename}.in" "@script_initial_cache@\n")
+  endif()
+  configure_file("${script_filename}.in" "${script_filename}")
+
+endfunction(_ep_write_initial_cache)
+
 
 function(ExternalProject_Get_Property name)
   foreach(var ${ARGN})
@@ -1224,6 +1248,14 @@ function(_ep_add_configure_command name)
     get_property(cmake_args TARGET ${name} PROPERTY _EP_CMAKE_ARGS)
     list(APPEND cmd ${cmake_args})
 
+    # If there are any CMAKE_CACHE_ARGS, write an initial cache and use it
+    get_property(cmake_cache_args TARGET ${name} PROPERTY _EP_CMAKE_CACHE_ARGS)
+    if(cmake_cache_args)
+      set(_ep_cache_args_script "${CMAKE_CURRENT_BINARY_DIR}/${name}-cache.cmake")
+      _ep_write_initial_cache("${_ep_cache_args_script}" "${cmake_cache_args}")
+      list(APPEND cmd "-C${_ep_cache_args_script}")
+    endif()
+
     get_target_property(cmake_generator ${name} _EP_CMAKE_GENERATOR)
     if(cmake_generator)
       list(APPEND cmd "-G${cmake_generator}" "${source_dir}")
@@ -1246,6 +1278,7 @@ function(_ep_add_configure_command name)
   endif()
   configure_file(${tmp_dir}/${name}-cfgcmd.txt.in ${tmp_dir}/${name}-cfgcmd.txt)
   list(APPEND file_deps ${tmp_dir}/${name}-cfgcmd.txt)
+  list(APPEND file_deps ${_ep_cache_args_script})
 
   get_property(log TARGET ${name} PROPERTY _EP_LOG_CONFIGURE)
   if(log)

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

Summary of changes:
 Modules/ExternalProject.cmake |   48 ++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 47 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list