Browse Source

Fix building tests, move binaries to different output directory.

pull/257/head
EinMByte 9 years ago
parent
commit
5d00ad6473
  1. 2
      .gitignore
  2. 4
      CMakeLists.txt
  3. 11
      tests/CMakeLists.txt
  4. 2
      tests/Identity.cpp

2
.gitignore vendored

@ -13,6 +13,8 @@ build/CMakeFiles/* @@ -13,6 +13,8 @@ build/CMakeFiles/*
build/tests
build/client
build/core
build/i2pd
build/i2pd-tests
*.cmake
*.a
*.o

4
CMakeLists.txt

@ -11,6 +11,9 @@ option(WITH_UPNP "Include support for UPnP client" OFF) @@ -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) @@ -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)

11
tests/CMakeLists.txt

@ -12,12 +12,15 @@ if(WITH_TESTS) @@ -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()

2
tests/Identity.cpp

@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
#define BOOST_TEST_DYN_LINK
#include <boost/test/unit_test.hpp>
#include "../Identity.h"
#include "Identity.h"
BOOST_AUTO_TEST_SUITE(IdentityTests)

Loading…
Cancel
Save