[asterisk-scf-commits] asterisk-scf/integration/cmake.git branch "single-build-dir" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Tue Apr 26 11:48:23 CDT 2011


branch "single-build-dir" has been updated
       via  4b00f584ee6f3ed0763124efb90fdbb0f108d77b (commit)
       via  4d3509c5aba99dd3dba2072f4bc3ec52b06a8c52 (commit)
      from  20915be35f2cfb3ce65aaf6bc155a6241f9bc6e4 (commit)

Summary of changes:
 AsteriskSCF.cmake |   90 ++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 65 insertions(+), 25 deletions(-)


- Log -----------------------------------------------------------------
commit 4b00f584ee6f3ed0763124efb90fdbb0f108d77b
Author: Kevin P. Fleming <kpfleming at digium.com>
Date:   Tue Apr 26 11:43:57 2011 -0500

    Build test paths properly on both Windows and UNIX-type platforms. Build
    LD_LIBRARY_PATH on UNIX-type platforms. Eliminate code duplication in setting
    test properties.

diff --git a/AsteriskSCF.cmake b/AsteriskSCF.cmake
index 649c512..e568b5a 100644
--- a/AsteriskSCF.cmake
+++ b/AsteriskSCF.cmake
@@ -186,7 +186,7 @@ macro(set_cache_var_list VAR LIST TYPE DESCRIPTION)
     set(${VAR} "${_scvl}" CACHE ${TYPE} ${DESCRIPTION} FORCE)
 endmacro()
 
-macro(compute_test_path)
+macro(compute_test_paths)
   # We need to construct a PATH that will allow unit tests to be run
   # against the versions of Ice and Boost that the components and test
   # were built against.
@@ -199,27 +199,61 @@ macro(compute_test_path)
   # Add the project's binary directories for tests and components
   file(TO_NATIVE_PATH "${PROJECT_BINARY_DIR}/bin" foo)
   list(APPEND test_path_dirs "${foo}")
-  file(TO_NATIVE_PATH "${PROJECT_BINARY_DIR}/lib" foo)
-  list(APPEND test_path_dirs "${foo}")
 
   # Add the Ice directory that contains executables
   file(TO_NATIVE_PATH "${ICE_DIR}/bin" foo)
   list(APPEND test_path_dirs "${foo}")
 
   # On Windows, we also need some additional directories
-  foreach(test_path_dir ${Boost_LIBRARY_DIRS})
-    file(TO_NATIVE_PATH "${test_path_dir}" foo)
+  if(WIN32) 
+    file(TO_NATIVE_PATH "${PROJECT_BINARY_DIR}/lib" foo)
     list(APPEND test_path_dirs "${foo}")
+    foreach(test_path_dir ${Boost_LIBRARY_DIRS})
+      file(TO_NATIVE_PATH "${test_path_dir}" foo)
+      list(APPEND test_path_dirs "${foo}")
+    endforeach()
+  endif()
+
+  foreach(test_path_dir ${test_path_dirs})
+    if(NOT test_path)
+      set(test_path "${test_path_dir}")
+    else()
+      if(WIN32)
+	set(test_path "${test_path}\\;${test_path_dir}")
+      else()
+	set(test_path "${test_path}:${test_path_dir}")
+      endif()
+    endif()
   endforeach()
+  set(ASTERISK_SCF_BIN_TEST_PATH "${test_path}" PARENT_SCOPE)
+
+  # On UNIX-type platforms, we also need to set LD_LIBRARY_PATH
+  # so that our libraries can be found
+  if(UNIX)
+    unset(test_path_dirs)
+    unset(test_path)
+
+    # Start with the existing PATH
+    foreach(test_path_dir $ENV{LD_LIBRARY_PATH})
+      list(APPEND test_path_dirs "${test_path_dir}")
+    endforeach()
+
+    file(TO_NATIVE_PATH "${PROJECT_BINARY_DIR}/lib" foo)
+    list(APPEND test_path_dirs "${foo}")
 
-  # The sequence below is a bit bizarre; essentially, this compensates
-  # for the fact that CMake stores lists of items as semicolon separated
-  # entries, but we need to have a string that contains such entries
-  # *NOT* treated as if it was a list (so the semicolons won't be removed
-  # when the list is later expanded)
-  string(REPLACE "\\;" ";" test_path "${test_path_dirs}")
-  string(REPLACE ";" "\\;" test_path "${test_path}")
-  set(ASTERISK_SCF_TEST_PATH "${test_path}" PARENT_SCOPE)
+    foreach(test_path_dir ${test_path_dirs})
+      if(NOT test_path)
+	set(test_path "${test_path_dir}")
+      else()
+	if(WIN32)
+	  set(test_path "${test_path}\\;${test_path_dir}")
+	else()
+	  set(test_path "${test_path}:${test_path_dir}")
+	endif()
+      endif()
+    endforeach()
+    set(ASTERISK_SCF_LIB_TEST_PATH "${test_path}" PARENT_SCOPE)
+  endif()
 endmacro()
 
 # Function which initializes project specific things
@@ -343,7 +377,7 @@ function(asterisk_scf_project NAME ICE_VERSION)
     set(Boost_CORE_FOUND "bazinga" PARENT_SCOPE)
     set(Boost_CORE_FOUND "bazinga")
 
-    compute_test_path()
+    compute_test_paths()
 
     message(STATUS "Passed requirement checks for CXX components")
 endfunction()
@@ -770,17 +804,24 @@ function(asterisk_scf_component_package COMPONENTNAME DESC GROUPNAME)
     cpack_add_component(${COMPONENTNAME} DESCRIPTION ${DESC} GROUP ${GROUP})
 endfunction()
 
-# Adds a boost test executable to CTest.  These executable will be run
-# with 'make test'
-# @param EXE - boost test executable.  Probably built
-# using asterisk_scf_component_build_standalone.
+function(set_test_props NAME RESULTS)
+  set_property(TEST "${NAME}" PROPERTY TIMEOUT ${TEST_TIMEOUT_SEC})
+  list(APPEND testenv "PATH=${ASTERISK_SCF_BIN_TEST_PATH}")
+  if(UNIX)
+    list(APPEND testenv "LD_LIBRARY_PATH=${ASTERISK_SCF_LIB_TEST_PATH}")
+  endif()
+  list(APPEND testenv "BOOST_TEST_REPORT_FORMAT=XML")
+  list(APPEND testenv "BOOST_TEST_REPORT_LEVEL=detailed")
+  list(APPEND testenv "BOOST_TEST_REPORT_SINK=${RESULTS}")
+  set_property(TEST "${NAME}" PROPERTY ENVIRONMENT "${testenv}")
+endfunction()
+
 function(asterisk_scf_test_boost NAME)
     add_test(NAME "${NAME}" COMMAND "${NAME}")
     set(project_test_results "${CMAKE_BINARY_DIR}/test_results/${ASTERISK_SCF_PROJECT}")
     file(MAKE_DIRECTORY "${project_test_results}")
     file(TO_NATIVE_PATH "${project_test_results}/${NAME}.xml" project_test_results)
-    set_property(TEST "${NAME}" PROPERTY TIMEOUT ${TEST_TIMEOUT_SEC})
-    set_property(TEST "${NAME}" PROPERTY ENVIRONMENT "PATH=${ASTERISK_SCF_TEST_PATH};BOOST_TEST_REPORT_FORMAT=XML;BOOST_TEST_REPORT_LEVEL=detailed;BOOST_TEST_REPORT_SINK=${project_test_results}")
+    set_test_props("${NAME}" "${project_test_results}")
 endfunction()
 
 function(asterisk_scf_test_icebox NAME CONFIG)
@@ -789,6 +830,5 @@ function(asterisk_scf_test_icebox NAME CONFIG)
     set(project_test_results "${CMAKE_BINARY_DIR}/test_results/${ASTERISK_SCF_PROJECT}")
     file(MAKE_DIRECTORY "${project_test_results}")
     file(TO_NATIVE_PATH "${project_test_results}/${NAME}.xml" project_test_results)
-    set_property(TEST "${NAME}" PROPERTY TIMEOUT ${TEST_TIMEOUT_SEC})
-    set_property(TEST "${NAME}" PROPERTY ENVIRONMENT "PATH=${ASTERISK_SCF_TEST_PATH};BOOST_TEST_REPORT_FORMAT=XML;BOOST_TEST_REPORT_LEVEL=detailed;BOOST_TEST_REPORT_SINK=${project_test_results}")
+    set_test_props("${NAME}" "${project_test_results}")
 endfunction()

commit 4d3509c5aba99dd3dba2072f4bc3ec52b06a8c52
Author: Kevin P. Fleming <kpfleming at digium.com>
Date:   Tue Apr 26 11:17:11 2011 -0500

    Correct a bug in a previous commit; settings for CMake output directories
    need to be at the global scope.

diff --git a/AsteriskSCF.cmake b/AsteriskSCF.cmake
index cd82fc7..649c512 100644
--- a/AsteriskSCF.cmake
+++ b/AsteriskSCF.cmake
@@ -237,9 +237,9 @@ function(asterisk_scf_project NAME ICE_VERSION)
 
     message(STATUS "Setting up project ${NAME} for Ice version ${ICE_VERSION}")
 
-    set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
-    set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
-    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
+    set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib" PARENT_SCOPE)
+    set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib" PARENT_SCOPE)
+    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin" PARENT_SCOPE)
 
     # On Windows, IceBox C++ services must be compiled with some symbols exported;
     # the source code should use ASTERISK_SCF_ICEBOX_EXPORT to accomplish this, and this

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


-- 
asterisk-scf/integration/cmake.git



More information about the asterisk-scf-commits mailing list