From 1d8f6e94e73c569f09a2bc8bd008d0ceb2e5b8cc Mon Sep 17 00:00:00 2001 From: Maxim Biro Date: Mon, 29 Jul 2013 20:45:53 -0400 Subject: Fixed formatting of some cmake files --- other/bootstrap_serverdaemon/CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'other/bootstrap_serverdaemon/CMakeLists.txt') diff --git a/other/bootstrap_serverdaemon/CMakeLists.txt b/other/bootstrap_serverdaemon/CMakeLists.txt index 6aa4dbee..57ba4841 100644 --- a/other/bootstrap_serverdaemon/CMakeLists.txt +++ b/other/bootstrap_serverdaemon/CMakeLists.txt @@ -4,7 +4,9 @@ project(DHT_bootstrap_daemon C) set(exe_name DHT_bootstrap_daemon) add_executable(${exe_name} - DHT_bootstrap_daemon.c) + DHT_bootstrap_daemon.c) + +target_link_libraries(${exe_name} + config) -target_link_libraries(${exe_name} config) linkCoreLibraries(${exe_name}) -- cgit v1.2.3 From 4faa145789853caacb8dc37d505fa20f4879ffea Mon Sep 17 00:00:00 2001 From: Teknocrat Date: Tue, 30 Jul 2013 19:09:36 -0500 Subject: Update CMakeLists.txt This thing requires libconfig but doesn't test for it... --- other/bootstrap_serverdaemon/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) (limited to 'other/bootstrap_serverdaemon/CMakeLists.txt') diff --git a/other/bootstrap_serverdaemon/CMakeLists.txt b/other/bootstrap_serverdaemon/CMakeLists.txt index 57ba4841..f675396d 100644 --- a/other/bootstrap_serverdaemon/CMakeLists.txt +++ b/other/bootstrap_serverdaemon/CMakeLists.txt @@ -10,3 +10,6 @@ target_link_libraries(${exe_name} config) linkCoreLibraries(${exe_name}) + +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules") +find_package(LibConfig REQUIRED) -- cgit v1.2.3 From 89dd7ed0111d2aebe5d362052f8582bfc17c7cbc Mon Sep 17 00:00:00 2001 From: Dmitry Marakasov Date: Tue, 30 Jul 2013 22:41:51 +0400 Subject: Add detection of required libraries --- CMakeLists.txt | 8 ++++++-- cmake/FindLIBCONFIG.cmake | 15 +++++++++++++++ cmake/FindSODIUM.cmake | 15 +++++++++++++++ core/CMakeLists.txt | 2 ++ other/bootstrap_serverdaemon/CMakeLists.txt | 6 +++++- 5 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 cmake/FindLIBCONFIG.cmake create mode 100644 cmake/FindSODIUM.cmake (limited to 'other/bootstrap_serverdaemon/CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index c16ce6fe..c18d41d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,14 @@ cmake_minimum_required(VERSION 2.6.0) +set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) + #MinGW prints more warnings for -Wall than gcc does, thus causing build to fail if(NOT WIN32) if(("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")) message(STATUS "==== ${CMAKE_C_COMPILER_ID} detected - Adding compiler flags ====") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror") endif() + find_package(SODIUM REQUIRED) endif() macro(linkCoreLibraries exe_name) @@ -16,8 +19,9 @@ macro(linkCoreLibraries exe_name) ${CMAKE_SOURCE_DIR}/sodium/lib/libsodium.a ws2_32) else() + include_directories(${SODIUM_INCLUDE_DIR}) target_link_libraries(${exe_name} core - sodium) + ${SODIUM_LIBRARY}) endif() endmacro() @@ -25,4 +29,4 @@ cmake_policy(SET CMP0011 NEW) add_subdirectory(core) add_subdirectory(testing) -add_subdirectory(other) \ No newline at end of file +add_subdirectory(other) diff --git a/cmake/FindLIBCONFIG.cmake b/cmake/FindLIBCONFIG.cmake new file mode 100644 index 00000000..d5018240 --- /dev/null +++ b/cmake/FindLIBCONFIG.cmake @@ -0,0 +1,15 @@ +# Find LIBCONFIG +# +# LIBCONFIG_INCLUDE_DIR +# LIBCONFIG_LIBRARY +# LIBCONFIG_FOUND +# + +FIND_PATH(LIBCONFIG_INCLUDE_DIR NAMES libconfig.h) + +FIND_LIBRARY(LIBCONFIG_LIBRARY NAMES config) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBCONFIG DEFAULT_MSG LIBCONFIG_LIBRARY LIBCONFIG_INCLUDE_DIR) + +MARK_AS_ADVANCED(LIBCONFIG_INCLUDE_DIR LIBCONFIG_LIBRARY) diff --git a/cmake/FindSODIUM.cmake b/cmake/FindSODIUM.cmake new file mode 100644 index 00000000..ffb6a1f7 --- /dev/null +++ b/cmake/FindSODIUM.cmake @@ -0,0 +1,15 @@ +# Find SODIUM +# +# SODIUM_INCLUDE_DIR +# SODIUM_LIBRARY +# SODIUM_FOUND +# + +FIND_PATH(SODIUM_INCLUDE_DIR NAMES sodium.h) + +FIND_LIBRARY(SODIUM_LIBRARY NAMES sodium) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(SODIUM DEFAULT_MSG SODIUM_LIBRARY SODIUM_INCLUDE_DIR) + +MARK_AS_ADVANCED(SODIUM_INCLUDE_DIR SODIUM_LIBRARY) diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 420308d8..44ae980c 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -3,6 +3,8 @@ project(core C) if(WIN32) include_directories(${CMAKE_HOME_DIRECTORY}/sodium/include/) +else(WIN32) + include_directories(${SODIUM_INCLUDE_DIR}) endif() set(core_sources diff --git a/other/bootstrap_serverdaemon/CMakeLists.txt b/other/bootstrap_serverdaemon/CMakeLists.txt index 57ba4841..a9cfdff7 100644 --- a/other/bootstrap_serverdaemon/CMakeLists.txt +++ b/other/bootstrap_serverdaemon/CMakeLists.txt @@ -3,10 +3,14 @@ project(DHT_bootstrap_daemon C) set(exe_name DHT_bootstrap_daemon) +find_package(LIBCONFIG REQUIRED) + +include_directories(${LIBCONFIG_INCLUDE_DIR}) + add_executable(${exe_name} DHT_bootstrap_daemon.c) target_link_libraries(${exe_name} - config) + ${LIBCONFIG_LIBRARY}) linkCoreLibraries(${exe_name}) -- cgit v1.2.3