From 0700ae054385610eef21ba673413811b1d9e4b64 Mon Sep 17 00:00:00 2001 From: Dennis Brentjes Date: Thu, 15 Dec 2016 12:38:51 +0100 Subject: Debugged CMake files which caused compiler flags to be truncated --- CMakeLists.txt | 19 ++++++++++++------- CMakeModules/FindGcrypt.cmake | 8 ++++---- libcmix-crypto/CMakeLists.txt | 4 ++-- libcmix-crypto/elgamal/gcrypt/CMakeLists.txt | 17 ++++++++++++++--- libcmix-protobuf/CMakeLists.txt | 4 +++- node/CMakeLists.txt | 11 ----------- node/node.hpp | 2 ++ 7 files changed, 37 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bfad59e..5855117 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,18 @@ cmake_minimum_required(VERSION 3.6.1) project(cmix) +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +if(WIN32) + set(CMAKE_CXX_EXTENSIONS ON) +else(WIN32) + set(CMAKE_CXX_EXTENSIONS OFF) +endif(WIN32) + +set(CMAKE_C_STANDARD 99) +set(CMAKE_C_STANDARD_REQUIRED ON) +set(CMAKE_C_EXTENSIONS OFF) + list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules ${CMAKE_CURRENT_SOURCE_DIR}/wubwubcmake) list(APPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules) @@ -43,13 +55,6 @@ if(use_lto) set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -flto") endif(use_lto) -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) -set(CMAKE_C_STANDARD 99) -set(CMAKE_C_STANDARD_REQUIRED ON) -set(CMAKE_C_EXTENSIONS OFF) - add_subdirectory(libcmix-crypto) add_subdirectory(libcmix) diff --git a/CMakeModules/FindGcrypt.cmake b/CMakeModules/FindGcrypt.cmake index 1b4e8c8..46b135f 100644 --- a/CMakeModules/FindGcrypt.cmake +++ b/CMakeModules/FindGcrypt.cmake @@ -10,13 +10,13 @@ FIND_PROGRAM(libgcrypt_config_executable NAMES libgcrypt-config) # if libgcrypt-config has been found IF(libgcrypt_config_executable) - EXEC_PROGRAM(${libgcrypt_config_executable} ARGS --libs RETURN_VALUE _return_VALUE OUTPUT_VARIABLE Gcrypt_LIBRARIES) + execute_process(COMMAND ${libgcrypt_config_executable} --libs RESULT_VARIABLE _return_VALUE OUTPUT_VARIABLE Gcrypt_LIBRARIES OUTPUT_STRIP_TRAILING_WHITESPACE) - EXEC_PROGRAM(${libgcrypt_config_executable} ARGS --cflags RETURN_VALUE _return_VALUE OUTPUT_VARIABLE Gcrypt_CFLAGS) + execute_process(COMMAND ${libgcrypt_config_executable} --cflags RESULT_VARIABLE _return_VALUE OUTPUT_VARIABLE Gcrypt_CFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE) - IF(Gcrypt_LIBRARIES AND Gcrypt_CFLAGS) + IF(Gcrypt_LIBRARIES) SET(Gcrypt_FOUND TRUE) - ENDIF(Gcrypt_LIBRARIES AND Gcrypt_CFLAGS) + ENDIF(Gcrypt_LIBRARIES) ENDIF(libgcrypt_config_executable) diff --git a/libcmix-crypto/CMakeLists.txt b/libcmix-crypto/CMakeLists.txt index 7fa0d29..56dd553 100644 --- a/libcmix-crypto/CMakeLists.txt +++ b/libcmix-crypto/CMakeLists.txt @@ -13,7 +13,7 @@ set(interface_sources ) target_sources(cmix-crypto-interface - INTERFACE ${interace_sources} + INTERFACE ${interface_sources} ) include(curve25519_implementations) @@ -32,7 +32,7 @@ target_sources(cmix-crypto INTERFACE ${interface_sources} ) -option(UseEC "Use curve25519 instead of RSA" OFF) +option(UseEC "Use curve25519 instead of elgamal in a multiplicative group" OFF) if(UseEC) target_link_libraries(cmix-crypto diff --git a/libcmix-crypto/elgamal/gcrypt/CMakeLists.txt b/libcmix-crypto/elgamal/gcrypt/CMakeLists.txt index 85d532b..d8c19b8 100644 --- a/libcmix-crypto/elgamal/gcrypt/CMakeLists.txt +++ b/libcmix-crypto/elgamal/gcrypt/CMakeLists.txt @@ -16,9 +16,20 @@ if(trace_pointers) ) endif(trace_pointers) -target_compile_options(${target_name} - PUBLIC ${Gcrypt_CFLAGS} -) +if(NOT Gcrypt_CFLAGS STREQUAL "") + IF(WIN32) + separate_arguments(flags WINDOWS_COMMAND ${Gcrypt_CFLAGS}) + else(WIN32) + separate_arguments(flags UNIX_COMMAND ${Gcrypt_CFLAGS}) + endif(WIN32) + + foreach(flag ${flags}) + target_compile_options(${target_name} + PUBLIC ${flag} + ) + endforeach(flag) +endif(NOT Gcrypt_CFLAGS STREQUAL "") + target_link_libraries(${target_name} PRIVATE elgamal-interface diff --git a/libcmix-protobuf/CMakeLists.txt b/libcmix-protobuf/CMakeLists.txt index 725cbf3..c080220 100644 --- a/libcmix-protobuf/CMakeLists.txt +++ b/libcmix-protobuf/CMakeLists.txt @@ -24,4 +24,6 @@ target_compile_options(cmix-protobuf PRIVATE -Wno-unused-parameter ) -target_link_libraries(cmix-protobuf ${Protobuf_LIBRARIES}) \ No newline at end of file +target_link_libraries(cmix-protobuf + PRIVATE ${Protobuf_LIBRARIES} +) \ No newline at end of file diff --git a/node/CMakeLists.txt b/node/CMakeLists.txt index 87d3385..c20b35c 100644 --- a/node/CMakeLists.txt +++ b/node/CMakeLists.txt @@ -5,17 +5,6 @@ add_executable(node node.hpp node_node.cpp node_client.cpp node.cpp ) -if(WIN32) - target_compile_options(node - PRIVATE "-std=gnu++11" - ) -else(WIN32) - target_compile_options(node - PRIVATE "-std=c++11" - ) -endif(WIN32) - - target_link_libraries(node PRIVATE Boost::boost PRIVATE Boost::program_options diff --git a/node/node.hpp b/node/node.hpp index d9e16d4..de4e25d 100644 --- a/node/node.hpp +++ b/node/node.hpp @@ -92,7 +92,9 @@ class Node typedef std::map ClientConnections; ClientConnections clients; +public: typedef std::map ClientData; +private: ClientData data; typedef std::map> ClientMessages; ClientMessages messages; -- cgit v1.2.3-70-g09d2