changeset 1948:326fdda31b42

fix
author jodogne
date Tue, 05 Apr 2016 10:22:19 +0200
parents c1053112b323
children d90f737f2dde
files Resources/CMake/JsonCppConfiguration.cmake
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/Resources/CMake/JsonCppConfiguration.cmake	Tue Apr 05 10:11:40 2016 +0200
+++ b/Resources/CMake/JsonCppConfiguration.cmake	Tue Apr 05 10:22:19 2016 +0200
@@ -33,21 +33,25 @@
   endif()
 
   # Switch to the C++11 standard if the version of JsonCpp is 1.y.z
-  message(${JSONCPP_INCLUDE_DIR}/json/version.h)
   if (EXISTS ${JSONCPP_INCLUDE_DIR}/json/version.h)
     file(STRINGS
       "${JSONCPP_INCLUDE_DIR}/json/version.h" 
       JSONCPP_VERSION_MAJOR1 REGEX
-      ".*JSONCPP_VERSION_MAJOR .*")
+      ".*define JSONCPP_VERSION_MAJOR.*")
+
+    if (NOT JSONCPP_VERSION_MAJOR1)
+      message(FATAL_ERROR "Unable to extract the major version of JsonCpp")
+    endif()
+    
     string(REGEX REPLACE
-      ".*JSONCPP_VERSION_MAJOR ([0-9]+)\\s*$" "\\1" 
+      ".*JSONCPP_VERSION_MAJOR.*([0-9]+)$" "\\1" 
       JSONCPP_VERSION_MAJOR ${JSONCPP_VERSION_MAJOR1})
     message("JsonCpp major version: ${JSONCPP_VERSION_MAJOR}")
 
     if (CMAKE_COMPILER_IS_GNUCXX AND 
         JSONCPP_VERSION_MAJOR GREATER 0)
       message("Switching to C++11 standard, as version of JsonCpp is >= 1.0.0")
-      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-deprecated-declarations")
     endif()
   else()
     message("Unable to detect the major version of JsonCpp, assuming < 1.0.0")