diff --git a/.gitignore b/.gitignore index 89ca7ebc..6525ba45 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,8 @@ build/CMakeFiles/* build/tests build/client build/core +build/i2pd +build/i2pd-tests *.cmake *.a *.o diff --git a/CMakeLists.txt b/CMakeLists.txt index 16a29d8c..32a04a4b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,6 +11,9 @@ option(WITH_UPNP "Include support for UPnP client" OFF) option(WITH_TESTS "Build unit tests" OFF) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build/cmake_modules") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) # Default build is Debug if(NOT CMAKE_BUILD_TYPE) @@ -167,6 +170,7 @@ include(GNUInstallDirs) set(CORE_NAME "${PROJECT_NAME}-core") set(CLIENT_NAME "${PROJECT_NAME}-client") +set(TESTS_NAME "${PROJECT_NAME}-tests") add_subdirectory(core) add_subdirectory(client) add_subdirectory(tests) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index c3af198e..37199b16 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -12,12 +12,15 @@ if(WITH_TESTS) unit_test_framework REQUIRED ) - add_executable(i2pd_tests ${TESTS_SRC}) + add_executable(${TESTS_NAME} ${TESTS_SRC}) target_link_libraries( - i2pd_tests core ${DL_LIB} ${Boost_LIBRARIES} ${CRYPTO++_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} + ${TESTS_NAME} ${CORE_NAME} ${DL_LIB} ${Boost_LIBRARIES} ${CRYPTO++_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} ) enable_testing() - add_test(i2pdTest i2pd_tests) + add_test(i2pdTest ${TESTS_NAME}) + install(TARGETS + ${TESTS_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) endif() diff --git a/tests/Identity.cpp b/tests/Identity.cpp index d74369a9..423ebb0e 100644 --- a/tests/Identity.cpp +++ b/tests/Identity.cpp @@ -2,7 +2,7 @@ #define BOOST_TEST_DYN_LINK #include -#include "../Identity.h" +#include "Identity.h" BOOST_AUTO_TEST_SUITE(IdentityTests)