[asterisk-scf-commits] asterisk-scf/integration/cmake.git branch "c++0x" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Wed Dec 1 09:19:19 CST 2010


branch "c++0x" has been updated
       via  f0f82cec7e12fd29137c35649efc367a0a480138 (commit)
       via  c466e0092a8dd0f01ff999609f686474dc640128 (commit)
       via  b19a7d9c985a79bca1580b57190cb8b7bd11e203 (commit)
       via  9c9a5dfcac3ae1eb745dc0c2905221d3d276d2a9 (commit)
      from  83a93acc047457469342e1a6b63fa2fd69c903d2 (commit)

Summary of changes:
 AsteriskSCF.cmake |   45 +++++++++++++++++++++++++++++++--------------
 1 files changed, 31 insertions(+), 14 deletions(-)


- Log -----------------------------------------------------------------
commit f0f82cec7e12fd29137c35649efc367a0a480138
Merge: c466e00 83a93ac
Author: Joshua Colp <jcolp at digium.com>
Date:   Wed Dec 1 11:18:33 2010 -0400

    Merge branch 'c++0x' of git.asterisk.org:asterisk-scf/integration/cmake into c++0x
    
    Conflicts:
    	AsteriskSCF.cmake


commit c466e0092a8dd0f01ff999609f686474dc640128
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Nov 29 18:52:50 2010 -0400

    Enable C++0x support on GCC versions where it is supported.

diff --git a/AsteriskSCF.cmake b/AsteriskSCF.cmake
index e347b90..7f52e4d 100644
--- a/AsteriskSCF.cmake
+++ b/AsteriskSCF.cmake
@@ -55,6 +55,23 @@ if(NOT integrated_build)
     message(FATAL_ERROR "This project can not be built in a non-integrated fashion. Please use the gitall script present in the gitall repository.")
 endif()
 
+# Use a compile test to see if shared_ptr is supported. If present then C++0x support exists.
+if(CMAKE_COMPILER_IS_GNUCXX)
+    try_compile(SHARED_PTR_PRESENT
+            ${CMAKE_BINARY_DIR}
+            ${CMAKE_SOURCE_DIR}/cmake/modules/SharedPtr.cpp
+            COMPILE_DEFINITIONS "-std=c++0x"
+            OUTPUT_VARIABLE OUTPUT
+    )
+    if(SHARED_PTR_PRESENT)
+        message(STATUS "Support for C++0x Enabled")
+	add_definitions("-DCPP_ZEROX_SUPPORT")
+	set(CPP_ZEROX_STD "-std=c++0x")
+    else()
+        message(STATUS "Support for C++0x Disabled")
+    endif()
+endif()
+
 list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
 
 # If a build type has not been explicitly specified then use debug
@@ -80,7 +97,9 @@ if(CMAKE_COMPILER_IS_GNUC)
         CACHE STRING "Flags used by the compiler during debug builds." FORCE)
 endif()
 if(CMAKE_COMPILER_IS_GNUCXX)
-    set(CMAKE_CXX_FLAGS_DEBUG "-Werror -Wall -g3"
+    set(CMAKE_CXX_FLAGS "${CPP_ZEROX_STD}"
+        CACHE STRING "Flags used by the compiler during release builds." FORCE)
+    set(CMAKE_CXX_FLAGS_DEBUG "-Werror -Wall -g3 ${CPP_ZEROX_STD}"
         CACHE STRING "Flags used by the compiler during debug builds." FORCE)
 endif()
 
@@ -198,6 +217,16 @@ function(find_ICE_CXX)
     else()
         message(FATAL_ERROR "Failed to find Ice headers for CXX")
     endif()
+    # This block essentially tricks the GNU compiler into treating the Ice header files as system headers. This has
+    # the benefit of having warnings emitted by the headers NOT treated as errors, even if the compiler has been told
+    # to do so. This is currently being utilized by the C++0x support in this file so that Ice itself does not have to
+    # be updated to be C++0x safe.
+    if(CMAKE_COMPILER_IS_GNUCXX)
+        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${ICE_CXX_INCLUDE_DIR}"
+            CACHE STRING "Flags used by the compiler during release builds." FORCE)
+        set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -isystem ${ICE_CXX_INCLUDE_DIR}"
+            CACHE STRING "Flags used by the compiler during debug builds." FORCE)
+    endif()
 endfunction()
 
 # Find an Ice library for CXX components
diff --git a/modules/SharedPtr.cpp b/modules/SharedPtr.cpp
new file mode 100644
index 0000000..eb7339f
--- /dev/null
+++ b/modules/SharedPtr.cpp
@@ -0,0 +1,7 @@
+#include <memory>
+
+int main()
+{
+    std::shared_ptr<void> bob;
+    return 0;
+}

commit b19a7d9c985a79bca1580b57190cb8b7bd11e203
Author: David M. Lee <dlee at digium.com>
Date:   Tue Nov 30 11:21:44 2010 -0600

    Minimize cmake warning noise.
    
    I'm a bit smarter than I was when I wrote that bit of script.  Now the
    warning that profile builds aren't supported on Windows is only printed
    if you attempt to build a profile build on Windows.

diff --git a/AsteriskSCF.cmake b/AsteriskSCF.cmake
index 89de85d..e347b90 100644
--- a/AsteriskSCF.cmake
+++ b/AsteriskSCF.cmake
@@ -60,7 +60,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
 # If a build type has not been explicitly specified then use debug
 if(NOT CMAKE_BUILD_TYPE)
     set(CMAKE_BUILD_TYPE Debug CACHE STRING
-        "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
+        "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel Profile."
         FORCE)
 endif()
 
@@ -84,9 +84,11 @@ if(CMAKE_COMPILER_IS_GNUCXX)
         CACHE STRING "Flags used by the compiler during debug builds." FORCE)
 endif()
 
-if(WIN32)
-    message(WARNING "Profile builds not supported")
-else()
+if(WIN32 AND ${CMAKE_BUILD_TYPE} STREQUAL profile)
+    message(FATAL_ERROR "Profile builds not supported")
+endif()
+
+if(NOT WIN32)
     message(STATUS "Adding profile flags")
     set(CMAKE_C_FLAGS_PROFILE
         "${CMAKE_C_FLAGS_DEBUG} -ftest-coverage -fprofile-arcs"

commit 9c9a5dfcac3ae1eb745dc0c2905221d3d276d2a9
Author: David M. Lee <dlee at digium.com>
Date:   Tue Nov 30 11:15:12 2010 -0600

    Consistently set debug compilation flags.
    
    Turns out CMake will accept debug, Debug, or DeBuG as the same build
    type.
    * tolower the CMAKE_BUILD_TYPE, so we can strequal it reliably.
    * set compilation flags using CMAKE_C_FLAGS_DEBUG and
      CMAKE_CXX_FLAGS_DEBUG

diff --git a/AsteriskSCF.cmake b/AsteriskSCF.cmake
index 641ec29..89de85d 100644
--- a/AsteriskSCF.cmake
+++ b/AsteriskSCF.cmake
@@ -64,6 +64,10 @@ if(NOT CMAKE_BUILD_TYPE)
         FORCE)
 endif()
 
+# since Debug, debug and DeBuG all mean the same thing to cmake, tolower it
+# for consistency
+string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE)
+
 # threading support required
 find_package(Threads REQUIRED)
 
@@ -71,6 +75,14 @@ if(CMAKE_SYSTEM MATCHES "SunOS.*")
     set(CMAKE_CXX_FLAGS "-pthreads ")
 endif()
 
+if(CMAKE_COMPILER_IS_GNUC)
+    set(CMAKE_C_FLAGS_DEBUG "-Werror -Wall -g3"
+        CACHE STRING "Flags used by the compiler during debug builds." FORCE)
+endif()
+if(CMAKE_COMPILER_IS_GNUCXX)
+    set(CMAKE_CXX_FLAGS_DEBUG "-Werror -Wall -g3"
+        CACHE STRING "Flags used by the compiler during debug builds." FORCE)
+endif()
 
 if(WIN32)
     message(WARNING "Profile builds not supported")
@@ -303,9 +315,6 @@ function(asterisk_scf_project NAME ICE_VERSION)
             message(STATUS "Passed requirement checks for CSharp components")
         elseif(l STREQUAL "CXX")
             message(STATUS "Performing requirement checks for CXX components")
-            if(CMAKE_COMPILER_IS_GNUCXX)
-	        set(CMAKE_CXX_FLAGS_DEBUG "-g3 -Wall")
-            endif()
             find_ICE_CXX()
             find_ICE_CXX_library(Ice)
             find_ICE_CXX_library(IceUtil)
@@ -740,9 +749,6 @@ function(asterisk_scf_component_add_file COMPONENT)
     set(file_list ${${COMPONENT}_SOURCES})
     foreach(file ${ARGN})
         list(APPEND file_list ${CMAKE_CURRENT_SOURCE_DIR}/${file})
-        if(ASTERISK_SCF_${COMPONENT}_LANG STREQUAL "CXX" AND CMAKE_COMPILER_IS_GNUCXX AND CMAKE_BUILD_TYPE STREQUAL Debug)
-            set_source_files_properties(${file} COMPILE_FLAGS "-Wall -Werror")
-        endif()
     endforeach()
     list(REMOVE_DUPLICATES file_list)
     set(${COMPONENT}_SOURCES ${file_list} PARENT_SCOPE)

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


-- 
asterisk-scf/integration/cmake.git



More information about the asterisk-scf-commits mailing list