From 5d45f6b1dce06fd7db0afaea5a912dc7278c3d27 Mon Sep 17 00:00:00 2001 From: Rohit Gupta <rohit.gupta@eurecom.fr> Date: Sat, 1 Oct 2016 08:54:27 -0700 Subject: [PATCH] cmake list fix for detecting nettle version for at_commands --- cmake_targets/at_commands/CMakeLists.txt | 18 ++++++++++++++++++ cmake_targets/autotests/README.txt | 1 - 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/cmake_targets/at_commands/CMakeLists.txt b/cmake_targets/at_commands/CMakeLists.txt index 0b8bfed25b..951384bd02 100755 --- a/cmake_targets/at_commands/CMakeLists.txt +++ b/cmake_targets/at_commands/CMakeLists.txt @@ -92,6 +92,24 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.2 -std=gnu99 -Wall -Wstrict-prototype set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb -DMALLOC_CHECK_=3") set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -ggdb -DMALLOC_CHECK_=3 -O2") +#This is to detect nettle version changes between Ubuntu 14.04/16.04 +set ( nettle_cmd "nettle-hash" ) +set ( nettle_arg "-V" ) +execute_process(COMMAND ${nettle_cmd} ${nettle_arg} RESULT_VARIABLE rv OUTPUT_VARIABLE ov ERROR_VARIABLE ev) + +string(REGEX MATCH "[+-]?[0-9]+([.][0-9]+)?" nv ${ov}) + +message("NETTLE_VERSION = ${nv}") + +# we need to remove decimal as floating point arithematic does not work properly with C preprocessor +STRING(REGEX REPLACE "[.]" "" nv ${nv}) + +if ("${nv}" STREQUAL "") + message( FATAL_ERROR "The nettle version not detected properly. Try to run build_oai -I again" ) +endif() + +set (NETTLE_VERSION "${nv}") +add_definitions("-DNETTLE_VERSION=${NETTLE_VERSION}") include(FindPkgConfig) diff --git a/cmake_targets/autotests/README.txt b/cmake_targets/autotests/README.txt index f4e50a7e51..2a1b57c0b2 100644 --- a/cmake_targets/autotests/README.txt +++ b/cmake_targets/autotests/README.txt @@ -1,5 +1,4 @@ OAI Test PLAN -#UNDER CONSTRUCTION. Not correct at the moment Obj.# Case# Test# Description -- 2.26.2