fixed cmake again...
authorFelix Morgner <felix.morgner@gmail.com>
Mon, 13 Jan 2014 16:50:05 +0000 (17:50 +0100)
committerFelix Morgner <felix.morgner@gmail.com>
Mon, 13 Jan 2014 16:50:05 +0000 (17:50 +0100)
.gitignore
CMakeLists.txt
src/client.h
src/config.h.in [new file with mode: 0644]
src/crypt.h
src/ssl.h

index 378eac25d311703f3f2cd456d8036da525cd0366..b7e85fee5807ff2658127c677d4cd8161bad738a 100644 (file)
@@ -1 +1,2 @@
 build
+config.h
index e8c532ca5b166eca8e7b649f99f9d91b9c04070c..4886e40d93d2fa0100b0394f35d454d6a59e6613 100644 (file)
@@ -9,15 +9,16 @@ include(CheckFunctionExists)
 include(CheckLibraryExists)
 include(CheckSymbolExists)
 
-pkg_check_modules(LIBCONFIG libconfig)
-pkg_check_modules(LIBPROTOBUF libprotobuf-c)
-
-if(DEFINED SSL)
-  pkg_check_modules(SSLIMP REQUIRED ${SSL})
+if(SSL MATCHES "openssl")
+  pkg_check_modules(SSLIMP REQUIRED openssl)
 else()
   pkg_check_modules(SSLIMP REQUIRED polarssl)
+  set(USE_POLARSSL ON)
 endif()
 
+pkg_check_modules(LIBCONFIG libconfig)
+pkg_check_modules(LIBPROTOBUF libprotobuf-c)
+
 check_function_exists(clock_gettime HAVE_CLOCK_GETTIME)
 
 if(NOT HAVE_CLOCK_GETTIME)
@@ -33,12 +34,13 @@ if(NOT HAVE_CLOCK_GETTIME)
 endif()
 
 set(SOURCE "")
-
 add_subdirectory(src)
 include_directories(include)
 
-add_definitions(${LIBCONFIG_CFLAGS} ${LIBPROTOBUF_CFLAGS} ${SSLIMP_CFLAGS})
-#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBCONFIG_CFLAGS} ${LIBPROTOBUF_CFLAGS}")
-
 add_executable(umurmurd ${SOURCE})
+
+
+add_definitions(${LIBCONFIG_CFLAGS} ${LIBPROTOBUF_CFLAGS} ${SSLIMP_CFLAGS})
 target_link_libraries(umurmurd ${LIBCONFIG_LIBRARIES} ${LIBPROTOBUF_LIBRARIES} ${SSLIMP_LIBRARIES})
+
+configure_file(src/config.h.in ${CMAKE_SOURCE_DIR}/src/config.h)
index 8891ebed1dbecb15c8d877c3bc3b565336f04922..c6085d298e6563779f4763f60d4d6f9b0ab284dd 100644 (file)
@@ -31,7 +31,7 @@
 #ifndef CLIENT_H_45786678
 #define CLIENT_H_45786678
 
-#include <config.h>
+#include "config.h"
 #include <stdint.h>
 #include <unistd.h>             /* close() */
 #include <sys/types.h>
diff --git a/src/config.h.in b/src/config.h.in
new file mode 100644 (file)
index 0000000..aaedfca
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef CONFIG_H
+#define CONFIG_H
+
+#cmakedefine USE_POLARSSL
+
+#endif // CONFIG_H
index e8f00c55c2cd1d08929b327f2b072328ccd1bf7f..292f196f6d72493e7fa38fe17c1cf726c2182308 100644 (file)
@@ -31,9 +31,7 @@
 #ifndef CRYPTSTATE_H_34564356
 #define CRYPTSTATE_H_34564356
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "config.h"
 
 #ifdef USE_POLARSSL
 #include <polarssl/havege.h>
index c495cc5f272daa04ad2fc1a4103a9be84452f4e1..f88e3017a8f80606623ba1206e28043a7bb38db5 100644 (file)
--- a/src/ssl.h
+++ b/src/ssl.h
@@ -32,9 +32,7 @@
 #ifndef SSL_H_987698
 #define SSL_H_987698
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "config.h"
 
 #ifdef USE_POLARSSL
 #include <polarssl/ssl.h>