From 106f31524bea2401601157931d0a0702ee0367a9 Mon Sep 17 00:00:00 2001 From: Cedric Roux <cedric.roux@eurecom.fr> Date: Fri, 27 Jan 2017 15:58:17 +0100 Subject: [PATCH] update CMakeLists for ubuntu 16.04 The previous version did not compile on ubuntu 16.04. I left the old version, commented, just in case. --- cmake_targets/at_commands/CMakeLists.txt | 52 ++++++++++++++++-------- 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/cmake_targets/at_commands/CMakeLists.txt b/cmake_targets/at_commands/CMakeLists.txt index 8993466bc25..61d1565bac9 100755 --- a/cmake_targets/at_commands/CMakeLists.txt +++ b/cmake_targets/at_commands/CMakeLists.txt @@ -88,31 +88,47 @@ 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) +##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}") -string(REGEX MATCH "[+-]?[0-9]+([.][0-9]+)?" nv ${ov}) +include(FindPkgConfig) -message("NETTLE_VERSION = ${nv}") +pkg_search_module(NETTLE nettle) +if(NOT ${NETTLE_FOUND}) + message( FATAL_ERROR "PACKAGE nettle not found: some targets will fail. Run build_oai -I again!") +else() + include_directories(${NETTLE_INCLUDE_DIRS}) +endif() + +message ("NETTLE VERSION_INSTALLED = ${NETTLE_VERSION}") -# we need to remove decimal as floating point arithematic does not work properly with C preprocessor -STRING(REGEX REPLACE "[.]" "" nv ${nv}) +string(REGEX REPLACE "([0-9]+).*" "\\1" NETTLE_VERSION_MAJOR ${NETTLE_VERSION}) +string(REGEX REPLACE "[0-9]+\\.([0-9]+).*" "\\1" NETTLE_VERSION_MINOR ${NETTLE_VERSION}) +message ("NETTLE_VERSION_MAJOR = ${NETTLE_VERSION_MAJOR}") +message ("NETTLE_VERSION_MINOR = ${NETTLE_VERSION_MINOR}") -if ("${nv}" STREQUAL "") +if ("${NETTLE_VERSION_MAJOR}" STREQUAL "" OR "${NETTLE_VERSION_MINOR}" 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) - -INCLUDE(FindNettle) -IF( NOT NETTLE_FOUND ) - MESSAGE( SEND_ERROR "Nettle is required" ) -ENDIF( NOT NETTLE_FOUND ) +add_definitions("-DNETTLE_VERSION_MAJOR=${NETTLE_VERSION_MAJOR}") +add_definitions("-DNETTLE_VERSION_MINOR=${NETTLE_VERSION_MINOR}") pkg_search_module(OPENSSL openssl REQUIRED) -- GitLab