From 1e8eb98d30459399902534082c88b94bb26bb2e3 Mon Sep 17 00:00:00 2001 From: Maksym Mamontov Date: Tue, 28 Jan 2020 17:43:23 +0200 Subject: [PATCH] Fix build on OSX. --- CMakeLists.txt | 4 +++- libs/CMakeLists.txt | 5 +++- sgauth/CMakeLists.txt | 5 +++- sgconf/options.cpp | 5 ++-- stargazer/actions.inl.h | 3 +-- stargazer/plugins/CMakeLists.txt | 9 ++++++++ stargazer/plugins/authorization/ao/ao.cpp | 28 ++++------------------- stargazer/plugins/other/radius/conn.cpp | 5 ++++ stargazer/user_impl.cpp | 2 +- stargazer/users_impl.cpp | 20 ++++++++-------- 10 files changed, 44 insertions(+), 42 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f543f1e..668b0ba3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,6 @@ -cmake_minimum_required (VERSION 3.1) +cmake_minimum_required (VERSION 3.12) + +project ( Stargazer ) set ( CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules ) diff --git a/libs/CMakeLists.txt b/libs/CMakeLists.txt index ece4c9a3..59caf2f1 100644 --- a/libs/CMakeLists.txt +++ b/libs/CMakeLists.txt @@ -1,8 +1,10 @@ set ( CMAKE_POSITION_INDEPENDENT_CODE ON ) if ( BUILD_LIB_COMMON ) + find_package ( Iconv REQUIRED ) add_library ( common STATIC common/blockio.cpp common/common.cpp common/strptime.cpp ) target_include_directories ( common PUBLIC common/include ) + target_link_libraries ( common Iconv::Iconv ) endif ( BUILD_LIB_COMMON ) if ( BUILD_LIB_CONFFILES ) @@ -32,9 +34,10 @@ if ( BUILD_LIB_IBPP ) endif ( BUILD_LIB_IBPP ) if ( BUILD_LIB_JSON ) + find_package ( YAJL REQUIRED ) add_library ( json STATIC json/generator.cpp json/parser.cpp ) target_include_directories ( json PUBLIC json/include ) - target_link_libraries ( json common ) + target_link_libraries ( json common YAJL::YAJL ) endif ( BUILD_LIB_JSON ) if ( BUILD_LIB_LOGGER ) diff --git a/sgauth/CMakeLists.txt b/sgauth/CMakeLists.txt index 1c346b79..2a87f3f6 100644 --- a/sgauth/CMakeLists.txt +++ b/sgauth/CMakeLists.txt @@ -2,14 +2,17 @@ set ( CPP_FILES main.cpp settings_impl.cpp web.cpp ) set ( THREADS_PREFER_PTHREAD_FLAG ON ) find_package ( Threads REQUIRED ) +find_package ( Intl REQUIRED ) file ( READ sgauth.css CSS_DATA ) configure_file ( css.h.in css.h ESCAPE_QUOTES @ONLY ) set ( CMAKE_INCLUDE_CURRENT_DIR ON ) +include_directories ( ${Intl_INCLUDE_DIRS} ) + add_executable ( sgauth ${CPP_FILES} ) -target_link_libraries ( sgauth conffiles ia crypto common Threads::Threads ) +target_link_libraries ( sgauth conffiles ia crypto common ${Intl_LIBRARIES} Threads::Threads ) # TODO: install diff --git a/sgconf/options.cpp b/sgconf/options.cpp index 49e04d64..e431bcb0 100644 --- a/sgconf/options.cpp +++ b/sgconf/options.cpp @@ -198,7 +198,7 @@ if (!m_description.empty()) std::cout << m_description << ":\n"; std::for_each(m_options.begin(), m_options.end(), - std::bind2nd(std::mem_fun_ref(&OPTION::Help), level + 1)); + [&level](const auto& opt){ opt.Help(level + 1); }); } PARSER_STATE OPTION_BLOCK::Parse(int argc, char ** argv, void * data) @@ -208,12 +208,11 @@ if (state.argc == 0) return state; while (state.argc > 0 && !state.stop) { - std::vector