[asterisk-scf-commits] asterisk-scf/release/cmake.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Thu Dec 30 00:08:21 UTC 2010


branch "master" has been updated
       via  24eb2e4838711d1265c3bb4c30cfdfa7a0fb3109 (commit)
      from  1338020044c4a0c0c74a11056d1c28442efd322c (commit)

Summary of changes:
 AsteriskSCF.cmake |   57 +++++++++++++++++++++++++++++++++-------------------
 1 files changed, 36 insertions(+), 21 deletions(-)


- Log -----------------------------------------------------------------
commit 24eb2e4838711d1265c3bb4c30cfdfa7a0fb3109
Author: Kevin P. Fleming <kpfleming at digium.com>
Date:   Wed Dec 29 18:06:53 2010 -0600

    Improve asterisk_scf_compile_slice() in two ways:
    
    * Fix broken dependency handling for Slice targets composed of
      more than one Slice file.
    
    * Allow specification of C++ .h and .cpp files that should be
      be included in the build of the Slice target for C++ builds.
    
    (I'm following the lead of the last person who worked on this
    function and continuing to not update the Syntax documentation.)

diff --git a/AsteriskSCF.cmake b/AsteriskSCF.cmake
index ccd9382..871d4fe 100644
--- a/AsteriskSCF.cmake
+++ b/AsteriskSCF.cmake
@@ -524,6 +524,12 @@ function(asterisk_scf_compile_slice TARGET_IN DIR_IN DESC_IN GROUP_IN)
 	            if(glob MATCHES "\\.ice$")
 	                list(APPEND slice_files "${cmake_path}")
 	            endif()
+	            if(glob MATCHES "\\.h$")
+	                list(APPEND cpp_header_files "${cmake_path}")
+	            endif()
+	            if(glob MATCHES "\\.cpp$")
+	                list(APPEND cpp_source_files "${cmake_path}")
+	            endif()
 	        endforeach()
             else()
 	        if(input MATCHES "\\.ice$")
@@ -547,7 +553,7 @@ function(asterisk_scf_compile_slice TARGET_IN DIR_IN DESC_IN GROUP_IN)
         # which is what the Slice compiler will need
         list(APPEND slice_compiler_arguments "-I${include}")
         # If there are any CXX targets that depend on this target,
-        # they'll need a path the *parallel* directory in the build
+        # they'll need a path to the *parallel* directory in the build
         # tree where the Slice compiler will have generated the
         # header file(s) for the Slice definitions in the source tree
         # but only if the Slice include path is actually part of the
@@ -628,28 +634,30 @@ function(asterisk_scf_compile_slice TARGET_IN DIR_IN DESC_IN GROUP_IN)
             string(REPLACE "\n" ";" raw_dependencies "${raw_dependencies}")
             string(REPLACE " ;" ";" raw_dependencies "${raw_dependencies}")
             string(REPLACE "; " ";" raw_dependencies "${raw_dependencies}")
-            # Remove the first item, since it is a Makefile target name, not a dependency
-            list(REMOVE_AT raw_dependencies 0)
 
             foreach(dep ${raw_dependencies})
-	        # Convert the path into a cmake one so we can absolutely get the filename
-	        file(TO_CMAKE_PATH ${dep} dep)
-	        file(RELATIVE_PATH relpath "${CMAKE_SOURCE_DIR}" "${dep}")
-	        string(REPLACE "/" "_" file_variable "${relpath}")
-	        set(dep_target ${TARGET_${file_variable}})
-	        if(dep_target)
-	            # If this is not already us add it as a dependency
-	            if(NOT dep_target STREQUAL ${TARGET})
-	                message(STATUS "Auto-adding dependency on Slice target ${dep_target} to ${TARGET} for ${lang} language")
-	                list(APPEND source_dependencies ${dep})
-	                list(APPEND target_dependencies ${dep_target}_${lang})
-	                list(APPEND target_CXX_includes ${ASTERISK_SCF_SLICE_${dep_target}_CXX_INCLUDE_DIRS})
+	        # If the name ends with a colon, it's actually a Makefile target name and should be
+		# skipped
+	        if(NOT dep MATCHES ":$")
+                    # Convert the path into a cmake one so we can absolutely get the filename
+	            file(TO_CMAKE_PATH ${dep} dep)
+	            file(RELATIVE_PATH relpath "${CMAKE_SOURCE_DIR}" "${dep}")
+	            string(REPLACE "/" "_" file_variable "${relpath}")
+	            set(dep_target ${TARGET_${file_variable}})
+	            if(dep_target)
+	                # If this is not already us add it as a dependency
+			if(NOT dep_target STREQUAL ${TARGET})
+	                    message(STATUS "Auto-adding dependency on Slice target ${dep_target} to ${TARGET} for ${lang} language")
+	                    list(APPEND source_dependencies ${dep})
+	                    list(APPEND target_dependencies ${dep_target}_${lang})
+	                    list(APPEND target_CXX_includes ${ASTERISK_SCF_SLICE_${dep_target}_CXX_INCLUDE_DIRS})
+			endif()
+	            else()
+	                # Remember sources that are not associated with targets too
+			message(STATUS "Auto-adding dependency on Slice source ${dep} to ${TARGET} for ${lang} language")
+			list(APPEND source_dependencies ${dep})
 	            endif()
-	        else()
-	            # Remember sources that are not associated with targets too
-	            message(STATUS "Auto-adding dependency on Slice source ${dep} to ${TARGET} for ${lang} language")
-	            list(APPEND source_dependencies ${dep})
-	        endif()
+		endif()
             endforeach()
         endif()
 
@@ -702,7 +710,14 @@ function(asterisk_scf_compile_slice TARGET_IN DIR_IN DESC_IN GROUP_IN)
             # by the actual compiler; this is to get them to show up as sources in the project
             # created for this target
             include_directories(${target_CXX_includes})
-            add_library(${TARGET}_${lang} ${generated_files} ${slice_files})
+	    # If there are any non-generated header files required for this Slice target, copy
+	    # them to the binary directory where they will be needed later. The destination
+	    # path to file() defaults to the binary directory, so there is no need to
+	    # re-specify it here.
+	    if(cpp_header_files)
+	      file(COPY ${cpp_header_files} DESTINATION .)
+	    endif()
+            add_library(${TARGET}_${lang} ${generated_files} ${slice_files} ${cpp_source_files})
             install(TARGETS ${TARGET}_${lang} DESTINATION ${DIR_IN} COMPONENT ${TARGET}_${lang})
             if(ASTERISKSCF_CPACK)
 	        # Adds a component to the packager. The first arg must have been previously defined

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


-- 
asterisk-scf/release/cmake.git



More information about the asterisk-scf-commits mailing list