polarssl: 1.3.7 work towards gcc2 support

* Compiles with gcc2 now, however package
  issues with haikuporter looking in
  .self/lib/x86_gcc2/libpolarssl.* vs
  .self/lib/libpolarssl.*.  prefix issues?
This commit is contained in:
Alexander von Gluck IV
2014-06-22 02:29:42 +00:00
parent fccfcddf34
commit 00292190ba

View File

@@ -1,7 +1,7 @@
From ec9957b03a66ec7a8656c75bb47f2937f62ff98b Mon Sep 17 00:00:00 2001
From: Alexander von Gluck IV <kallisti5@unixzen.com>
Date: Sat, 21 Jun 2014 22:37:56 +0000
Subject: [PATCH] library: Link in libnetwork on Haiku
Subject: [PATCH 1/2] library: Link in libnetwork on Haiku
---
library/CMakeLists.txt | 4 ++++
@@ -25,3 +25,56 @@ index 86ccee1..1aaa421 100644
--
1.8.3.4
From cef46eb4f9ac1eec70439bb2069c32884649ba02 Mon Sep 17 00:00:00 2001
From: Alexander von Gluck IV <kallisti5@unixzen.com>
Date: Sun, 22 Jun 2014 01:17:39 +0000
Subject: [PATCH 2/2] cmake: Detect old gcc and adjust flags
---
CMakeLists.txt | 9 ++++++++-
tests/CMakeLists.txt | 9 +++++++--
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index af268e7..1df9002 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,7 +4,14 @@ project(POLARSSL C)
string(REGEX MATCH "Clang" CMAKE_COMPILER_IS_CLANG "${CMAKE_C_COMPILER_ID}")
if(CMAKE_COMPILER_IS_GNUCC)
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -W -Wdeclaration-after-statement")
+ execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
+ OUTPUT_VARIABLE GCC_VERSION)
+ if(GCC_VERSION VERSION_GREATER 3.0)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -W -Wdeclaration-after-statement")
+ else()
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -W")
+ endif()
+
set(CMAKE_C_FLAGS_RELEASE "-O2")
set(CMAKE_C_FLAGS_DEBUG "-g3 -O0")
set(CMAKE_C_FLAGS_COVERAGE "-g3 -O0 --coverage")
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 0460c63..bac1f74 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -29,8 +29,13 @@ function(add_test_suite suite_name)
add_test(${data_name}-suite test_suite_${data_name})
endfunction(add_test_suite)
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function -Wno-unused-value")
-set(CMAKE_C_FLAGS_CHECK "${CMAKE_C_FLAGS_CHECK} -Wno-unused-function -Wno-unused-value")
+execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
+ OUTPUT_VARIABLE GCC_VERSION)
+if(GCC_VERSION VERSION_GREATER 3.0)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function -Wno-unused-value")
+ set(CMAKE_C_FLAGS_CHECK "${CMAKE_C_FLAGS_CHECK} -Wno-unused-function -Wno-unused-value")
+endif()
+
if(CMAKE_COMPILER_IS_CLANG)
set(CMAKE_C_FLAGS_CHECK "${CMAKE_C_FLAGS_CHECK} -Wno-unreachable-code")
endif(CMAKE_COMPILER_IS_CLANG)
--
1.8.3.4