From 5a5a5e8d35fb36151e3c687d728b0113a9f67234 Mon Sep 17 00:00:00 2001
From: David Walter Seikel
Date: Tue, 28 Jun 2011 04:52:49 +1000
Subject: Build libgpg-error and libgcrypt under linux, for OTR.

There is still a problem, the linux compile script (number 3) will bomb out at the link stage, but simply starting it again it runs fine.
This was too much work, and it's way past my bed time.  It works, so commiting it now, and fixing that problem later.

Still could use some cleaning up to.
---
 linden/indra/libgcrypt/CMakeLists.txt | 52 ++++++++++++++++++++++++++++++-----
 1 file changed, 45 insertions(+), 7 deletions(-)

(limited to 'linden/indra/libgcrypt')

diff --git a/linden/indra/libgcrypt/CMakeLists.txt b/linden/indra/libgcrypt/CMakeLists.txt
index 6c7446c..31c547f 100644
--- a/linden/indra/libgcrypt/CMakeLists.txt
+++ b/linden/indra/libgcrypt/CMakeLists.txt
@@ -2,6 +2,11 @@
 
 project(libgcrypt)
 
+include(00-Common)
+include(libgpg-error)
+include(libgcrypt)
+include(Linking)
+
 if (WINDOWS)
     include_directories(
 	../gpg.vs/inc.vs
@@ -11,13 +16,6 @@ if (WINDOWS)
 	libgcrypt-1.2.2/mpi
 	libgcrypt-1.2.2/mpi/generic
 	)
-else (WINDOWS)
-    include_directories(
-	libgcrypt-1.2.2/src
-	libgcrypt-1.2.2/mpi
-	libgcrypt-1.2.2/mpi/generic
-	)
-endif (WINDOWS)
 
 set(libgcrypt_SOURCE_FILES
     libgcrypt-1.2.2/src/ath.c
@@ -116,6 +114,46 @@ set_source_files_properties(${libgcrypt_HEADER_FILES}
 list(APPEND libgcrypt_SOURCE_FILES ${libgcrypt_HEADER_FILES})
 
 add_library (libgcrypt ${libgcrypt_SOURCE_FILES})
+
+else (WINDOWS)
+
+include(ExternalProject)
+
+    include_directories(
+        ${LIBGPG-ERROR_INCLUDE_DIRS}
+	libgcrypt-1.2.2/src
+	libgcrypt-1.2.2/mpi
+	libgcrypt-1.2.2/mpi/generic
+	libgcrypt-1.2.2
+	)
+
+# Gotta fake a DOWNLOAD_COMMAND to work around a bug in cmake before 2.8.3.
+externalproject_add(EP_libgcrypt
+    DEPENDS EP_libgpg-error
+    DOWNLOAD_COMMAND ""
+    PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/../libgcrypt/libgcrypt-1.2.2
+    SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../libgcrypt/libgcrypt-1.2.2
+    CONFIGURE_COMMAND <SOURCE_DIR>/configure -prefix=<INSTALL_DIR> --with-gpg-error-prefix=${CMAKE_CURRENT_SOURCE_DIR}/../libgpg-error/libgpg-error-1.0
+    BUILD_COMMAND ${MAKE}
+    BUILD_IN_SOURCE 1
+    INSTALL_COMMAND make install
+    )
+
+link_directories(${LIBGCRYPT_LIBRARIES})
+include_directories(${LIBGCRYPT_INCLUDE_DIRS})
+
+add_library(libgcrypt STATIC IMPORTED)
+
+set_target_properties(libgcrypt PROPERTIES 
+    IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/../libgcrypt/libgcrypt-1.2.2/lib/libgcrypt.a
+    )
+
+# This wont work until 2.8.4  sigh
+#add_dependencies(libgcrypt EP_libgcrypt)
+
+endif (WINDOWS)
+
 target_link_libraries(
     libgcrypt
     )
+
-- 
cgit v1.1