Skip to content

Commit

Permalink
Update CMakeLists.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
bartpomietlo authored Sep 22, 2024
1 parent b43a13b commit 9d0ed42
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ project(Exchange_Web_App_Tests)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)

# Znajdź paczki
# cmake_policy(SET CMP0167 NEW)

find_package(Boost REQUIRED COMPONENTS unit_test_framework system thread coroutine log beast asio)
find_package(unofficial-sqlite3 CONFIG REQUIRED)

# Dodaj pliki testowe i ustaw cel o unikalnej nazwie
add_executable(Exchange_Web_App_Test_Suite
add_executable(Exchange_Web_App_tests
test_main.cpp
test_money_converter.cpp
test_server_message_processing.cpp
Expand All @@ -21,14 +21,12 @@ add_executable(Exchange_Web_App_Test_Suite
../src/modules/server_file.cpp
)

# Dodaj katalogi do includów
target_include_directories(Exchange_Web_App_Test_Suite PRIVATE
target_include_directories(Exchange_Web_App_tests PRIVATE
${Boost_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/../src/modules
)

# Powiąż wymagane biblioteki
target_link_libraries(Exchange_Web_App_Test_Suite PRIVATE
target_link_libraries(Exchange_Web_App_tests PRIVATE
Boost::unit_test_framework
Boost::system
Boost::thread
Expand All @@ -40,18 +38,15 @@ target_link_libraries(Exchange_Web_App_Test_Suite PRIVATE
)

if (WIN32)
target_link_libraries(Exchange_Web_App_Test_Suite PRIVATE ws2_32)
target_link_libraries(Exchange_Web_App_tests PRIVATE ws2_32)
endif()

# Ustaw katalog wyjściowy dla pliku wykonywalnego na katalog `tests`
set_target_properties(Exchange_Web_App_Test_Suite PROPERTIES
set_target_properties(Exchange_Web_App_tests PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/tests"
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_SOURCE_DIR}/tests"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_SOURCE_DIR}/tests"
)

# Włącz testy
enable_testing()

# Dodaj test, który uruchamia plik wykonywalny testów
add_test(NAME Exchange_Web_App_Test_Suite COMMAND Exchange_Web_App_Test_Suite --log_level=test_suite)
add_test(NAME Exchange_Web_App_tests COMMAND Exchange_Web_App_tests --log_level=test_suite)

0 comments on commit 9d0ed42

Please sign in to comment.