From: Felix Morgner Date: Mon, 13 Jan 2014 16:50:05 +0000 (+0100) Subject: fixed cmake again... X-Git-Url: http://git.code-monkey.de/?p=umurmur.git;a=commitdiff_plain;h=59d006faba0b4f526010c66e9d4b8d3768450a6b fixed cmake again... --- diff --git a/.gitignore b/.gitignore index 378eac2..b7e85fe 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ build +config.h diff --git a/CMakeLists.txt b/CMakeLists.txt index e8c532c..4886e40 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/src/client.h b/src/client.h index 8891ebe..c6085d2 100644 --- a/src/client.h +++ b/src/client.h @@ -31,7 +31,7 @@ #ifndef CLIENT_H_45786678 #define CLIENT_H_45786678 -#include +#include "config.h" #include #include /* close() */ #include diff --git a/src/config.h.in b/src/config.h.in new file mode 100644 index 0000000..aaedfca --- /dev/null +++ b/src/config.h.in @@ -0,0 +1,6 @@ +#ifndef CONFIG_H +#define CONFIG_H + +#cmakedefine USE_POLARSSL + +#endif // CONFIG_H diff --git a/src/crypt.h b/src/crypt.h index e8f00c5..292f196 100644 --- a/src/crypt.h +++ b/src/crypt.h @@ -31,9 +31,7 @@ #ifndef CRYPTSTATE_H_34564356 #define CRYPTSTATE_H_34564356 -#ifdef HAVE_CONFIG_H -#include -#endif +#include "config.h" #ifdef USE_POLARSSL #include diff --git a/src/ssl.h b/src/ssl.h index c495cc5..f88e301 100644 --- 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 -#endif +#include "config.h" #ifdef USE_POLARSSL #include