diff options
Diffstat (limited to '')
-rw-r--r-- | tests/BlockTypeRegistry/CMakeLists.txt | 12 | ||||
-rw-r--r-- | tests/BoundingBox/CMakeLists.txt | 6 | ||||
-rw-r--r-- | tests/ByteBuffer/CMakeLists.txt | 6 | ||||
-rw-r--r-- | tests/CMakeLists.txt | 4 | ||||
-rw-r--r-- | tests/ChunkData/CMakeLists.txt | 7 | ||||
-rw-r--r-- | tests/CompositeChat/CMakeLists.txt | 6 | ||||
-rw-r--r-- | tests/FastRandom/CMakeLists.txt | 6 | ||||
-rw-r--r-- | tests/Generating/CMakeLists.txt | 9 | ||||
-rw-r--r-- | tests/HTTP/CMakeLists.txt | 7 | ||||
-rw-r--r-- | tests/LoadablePieces/CMakeLists.txt | 8 | ||||
-rw-r--r-- | tests/LuaThreadStress/CMakeLists.txt | 8 | ||||
-rw-r--r-- | tests/Network/CMakeLists.txt | 7 | ||||
-rw-r--r-- | tests/OSSupport/CMakeLists.txt | 45 | ||||
-rw-r--r-- | tests/SchematicFileSerializer/CMakeLists.txt | 7 | ||||
-rw-r--r-- | tests/UUID/CMakeLists.txt | 3 |
15 files changed, 32 insertions, 109 deletions
diff --git a/tests/BlockTypeRegistry/CMakeLists.txt b/tests/BlockTypeRegistry/CMakeLists.txt index 1b2749722..ef4803747 100644 --- a/tests/BlockTypeRegistry/CMakeLists.txt +++ b/tests/BlockTypeRegistry/CMakeLists.txt @@ -1,14 +1,6 @@ -cmake_minimum_required(VERSION 3.0.2) -enable_testing() - +find_package(Threads REQUIRED) include_directories(${CMAKE_SOURCE_DIR}/src/) -add_definitions(-DTEST_GLOBALS=1) - - - - - # Define individual test executables: # BlockStateTest: Verify that the BlockState class works as intended: @@ -41,7 +33,7 @@ add_executable(BlockTypeRegistryTest ${CMAKE_SOURCE_DIR}/src/StringUtils.cpp ${CMAKE_SOURCE_DIR}/src/OSSupport/CriticalSection.cpp ) -target_link_libraries(BlockTypeRegistryTest fmt::fmt) +target_link_libraries(BlockTypeRegistryTest fmt::fmt Threads::Threads) # PalettedBlockAreaTest: Verify that the PalettedBlockArea class works as intended: add_executable(PalettedBlockAreaTest diff --git a/tests/BoundingBox/CMakeLists.txt b/tests/BoundingBox/CMakeLists.txt index da960ba19..e102017f9 100644 --- a/tests/BoundingBox/CMakeLists.txt +++ b/tests/BoundingBox/CMakeLists.txt @@ -1,11 +1,5 @@ -cmake_minimum_required(VERSION 3.0.2) -enable_testing() -add_definitions(-DTEST_GLOBALS=1) - include_directories(${CMAKE_SOURCE_DIR}/src/) -add_definitions(-DTEST_GLOBALS=1) - set (SHARED_SRCS ${CMAKE_SOURCE_DIR}/src/BoundingBox.cpp ${CMAKE_SOURCE_DIR}/src/OSSupport/StackTrace.cpp diff --git a/tests/ByteBuffer/CMakeLists.txt b/tests/ByteBuffer/CMakeLists.txt index 989fabc23..654e68ec6 100644 --- a/tests/ByteBuffer/CMakeLists.txt +++ b/tests/ByteBuffer/CMakeLists.txt @@ -1,11 +1,5 @@ -cmake_minimum_required(VERSION 3.0.2) -enable_testing() -add_definitions(-DTEST_GLOBALS=1) - include_directories(${CMAKE_SOURCE_DIR}/src/) -add_definitions(-DTEST_GLOBALS=1) - set (SHARED_SRCS ${CMAKE_SOURCE_DIR}/src/ByteBuffer.cpp ${CMAKE_SOURCE_DIR}/src/StringUtils.cpp diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 74e4323ec..9b605470e 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,10 +1,8 @@ -enable_testing() - if (CMAKE_BUILD_TYPE STREQUAL "COVERAGE") setup_target_for_coverage("${PROJECT_NAME}_coverage" "ctest" coverage) endif() -add_definitions(-DTEST_GLOBALS=1) +add_compile_definitions(TEST_GLOBALS) add_subdirectory(BlockTypeRegistry) add_subdirectory(BoundingBox) diff --git a/tests/ChunkData/CMakeLists.txt b/tests/ChunkData/CMakeLists.txt index 5bd617f6c..ff7dca0da 100644 --- a/tests/ChunkData/CMakeLists.txt +++ b/tests/ChunkData/CMakeLists.txt @@ -1,10 +1,5 @@ -cmake_minimum_required(VERSION 3.0.2) -enable_testing() - include_directories(${CMAKE_SOURCE_DIR}/src/) - -add_definitions(-DTEST_GLOBALS=1) add_library(ChunkBuffer ${CMAKE_SOURCE_DIR}/src/ChunkData.cpp ${CMAKE_SOURCE_DIR}/src/StringUtils.cpp) target_link_libraries(ChunkBuffer PUBLIC fmt::fmt) @@ -43,5 +38,5 @@ set_target_properties( ) set_target_properties( ChunkBuffer - PROPERTIES FOLDER Lib + PROPERTIES FOLDER Tests/Libraries ) diff --git a/tests/CompositeChat/CMakeLists.txt b/tests/CompositeChat/CMakeLists.txt index 626a146f8..78847c443 100644 --- a/tests/CompositeChat/CMakeLists.txt +++ b/tests/CompositeChat/CMakeLists.txt @@ -1,13 +1,7 @@ -cmake_minimum_required(VERSION 3.0.2) -enable_testing() -add_definitions(-DTEST_GLOBALS=1) - include_directories(${CMAKE_CURRENT_SOURCE_DIR}) include_directories(${CMAKE_SOURCE_DIR}/src/) include_directories(${CMAKE_SOURCE_DIR}/lib/jsoncpp/include) -add_definitions(-DTEST_GLOBALS=1) - set (SHARED_SRCS ${CMAKE_SOURCE_DIR}/src/CompositeChat.cpp ${CMAKE_SOURCE_DIR}/src/JsonUtils.cpp diff --git a/tests/FastRandom/CMakeLists.txt b/tests/FastRandom/CMakeLists.txt index 3030b78e7..e780a2180 100644 --- a/tests/FastRandom/CMakeLists.txt +++ b/tests/FastRandom/CMakeLists.txt @@ -1,11 +1,5 @@ -cmake_minimum_required(VERSION 3.0.2) -enable_testing() -add_definitions(-DTEST_GLOBALS=1) - include_directories(${CMAKE_SOURCE_DIR}/src/) -add_definitions(-DTEST_GLOBALS=1) - set (SHARED_SRCS ${CMAKE_SOURCE_DIR}/src/FastRandom.cpp ${CMAKE_SOURCE_DIR}/src/StringUtils.cpp diff --git a/tests/Generating/CMakeLists.txt b/tests/Generating/CMakeLists.txt index b7ce70e13..241e2efb9 100644 --- a/tests/Generating/CMakeLists.txt +++ b/tests/Generating/CMakeLists.txt @@ -1,13 +1,8 @@ -cmake_minimum_required(VERSION 3.0.2) -enable_testing() - include_directories(${CMAKE_SOURCE_DIR}/src/) include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/lib/) include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/lib/mbedtls/include) include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -add_definitions(-DTEST_GLOBALS=1) - set (SHARED_SRCS ${CMAKE_SOURCE_DIR}/src/BiomeDef.cpp ${CMAKE_SOURCE_DIR}/src/BlockArea.cpp @@ -148,8 +143,8 @@ set (STUBS if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - add_flags_cxx("-Wno-error=global-constructors") - add_flags_cxx("-Wno-error=switch-enum") + add_compile_options("-Wno-error=global-constructors") + add_compile_options("-Wno-error=switch-enum") endif() diff --git a/tests/HTTP/CMakeLists.txt b/tests/HTTP/CMakeLists.txt index 4ca163864..a32355d95 100644 --- a/tests/HTTP/CMakeLists.txt +++ b/tests/HTTP/CMakeLists.txt @@ -1,12 +1,7 @@ -cmake_minimum_required(VERSION 3.0.2) -enable_testing() - include_directories(${CMAKE_SOURCE_DIR}/src/) include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/lib/libevent/include) include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/lib/mbedtls/include) -add_definitions(-DTEST_GLOBALS=1) - # Create a single HTTP library that contains all the HTTP code: set (HTTP_SRCS ${CMAKE_SOURCE_DIR}/src/HTTP/EnvelopeParser.cpp @@ -104,5 +99,5 @@ set_target_properties( ) set_target_properties( HTTP - PROPERTIES FOLDER Lib + PROPERTIES FOLDER Tests/Libraries ) diff --git a/tests/LoadablePieces/CMakeLists.txt b/tests/LoadablePieces/CMakeLists.txt index 4c8f698bf..e3aa369c2 100644 --- a/tests/LoadablePieces/CMakeLists.txt +++ b/tests/LoadablePieces/CMakeLists.txt @@ -1,11 +1,7 @@ -enable_testing() - include_directories(${CMAKE_SOURCE_DIR}/src/) include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/lib/) include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -add_definitions(-DTEST_GLOBALS=1) - set (SHARED_SRCS ${CMAKE_SOURCE_DIR}/src/BiomeDef.cpp ${CMAKE_SOURCE_DIR}/src/BlockArea.cpp @@ -75,8 +71,8 @@ set (SRCS if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - add_flags_cxx("-Wno-error=global-constructors") - add_flags_cxx("-Wno-error=switch-enum") + add_compile_options("-Wno-error=global-constructors") + add_compile_options("-Wno-error=switch-enum") endif() diff --git a/tests/LuaThreadStress/CMakeLists.txt b/tests/LuaThreadStress/CMakeLists.txt index 2f005a342..34e6836ec 100644 --- a/tests/LuaThreadStress/CMakeLists.txt +++ b/tests/LuaThreadStress/CMakeLists.txt @@ -1,12 +1,8 @@ -cmake_minimum_required(VERSION 3.0.2) -enable_testing() - +find_package(Threads REQUIRED) include_directories(${CMAKE_SOURCE_DIR}/src/) include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/lib/) include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -add_definitions(-DTEST_GLOBALS=1) - set (SHARED_SRCS ${CMAKE_SOURCE_DIR}/src/BiomeDef.cpp ${CMAKE_SOURCE_DIR}/src/BlockArea.cpp @@ -82,7 +78,7 @@ source_group("Shared" FILES ${SHARED_SRCS} ${SHARED_HDRS}) source_group("Sources" FILES ${SRCS}) source_group("Lua files" FILES Test.lua) add_executable(LuaThreadStress ${SRCS} ${SHARED_SRCS} ${SHARED_HDRS} Test.lua) -target_link_libraries(LuaThreadStress tolualib zlib fmt::fmt) +target_link_libraries(LuaThreadStress tolualib zlib fmt::fmt Threads::Threads) add_test(NAME LuaThreadStress-test WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND LuaThreadStress) diff --git a/tests/Network/CMakeLists.txt b/tests/Network/CMakeLists.txt index 0cc75f735..0fe639ba4 100644 --- a/tests/Network/CMakeLists.txt +++ b/tests/Network/CMakeLists.txt @@ -1,12 +1,7 @@ -cmake_minimum_required(VERSION 3.0.2) -enable_testing() - include_directories(${CMAKE_SOURCE_DIR}/src/) include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/lib/libevent/include) include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/lib/mbedtls/include) -add_definitions(-DTEST_GLOBALS=1) - # Create a single Network library that contains all the networking code: set (Network_SRCS ${CMAKE_SOURCE_DIR}/src/OSSupport/CriticalSection.cpp @@ -103,7 +98,7 @@ set_target_properties( ) set_target_properties( Network - PROPERTIES FOLDER Lib + PROPERTIES FOLDER Tests/Libraries ) diff --git a/tests/OSSupport/CMakeLists.txt b/tests/OSSupport/CMakeLists.txt index 60c68c472..9d481ce09 100644 --- a/tests/OSSupport/CMakeLists.txt +++ b/tests/OSSupport/CMakeLists.txt @@ -1,36 +1,29 @@ -cmake_minimum_required(VERSION 3.0.2) -enable_testing() - +find_package(Threads REQUIRED) include_directories(${CMAKE_SOURCE_DIR}/src/) -add_definitions(-DTEST_GLOBALS=1) - # Create a single OSSupport library that contains all the OSSupport code used in the tests: -# Only needed for Windows; Linux already defines the OSSupport lib -if (WIN32) - set (OSSupport_SRCS - ${CMAKE_SOURCE_DIR}/src/OSSupport/CriticalSection.cpp - ${CMAKE_SOURCE_DIR}/src/OSSupport/Event.cpp - ${CMAKE_SOURCE_DIR}/src/StringUtils.cpp - ) - set (OSSupport_HDRS - ${CMAKE_SOURCE_DIR}/src/OSSupport/CriticalSection.h - ${CMAKE_SOURCE_DIR}/src/OSSupport/Event.h - ${CMAKE_SOURCE_DIR}/src/StringUtils.h - ${CMAKE_SOURCE_DIR}/src/Globals.h - ) - add_library(OSSupport - ${OSSupport_SRCS} - ${OSSupport_HDRS} - ) - target_link_libraries(OSSupport PUBLIC fmt::fmt) -endif() +set (OSSupport_SRCS + ${CMAKE_SOURCE_DIR}/src/OSSupport/CriticalSection.cpp + ${CMAKE_SOURCE_DIR}/src/OSSupport/Event.cpp + ${CMAKE_SOURCE_DIR}/src/StringUtils.cpp +) +set (OSSupport_HDRS + ${CMAKE_SOURCE_DIR}/src/OSSupport/CriticalSection.h + ${CMAKE_SOURCE_DIR}/src/OSSupport/Event.h + ${CMAKE_SOURCE_DIR}/src/StringUtils.h + ${CMAKE_SOURCE_DIR}/src/Globals.h +) +add_library(OSSupport + ${OSSupport_SRCS} + ${OSSupport_HDRS} +) +target_link_libraries(OSSupport PUBLIC fmt::fmt) # Define individual tests: # StressEvent: Stress-test the cEvent implementation: add_executable(StressEvent-exe StressEvent.cpp) -target_link_libraries(StressEvent-exe OSSupport fmt::fmt) +target_link_libraries(StressEvent-exe OSSupport fmt::fmt Threads::Threads) add_test(NAME StressEvent-test COMMAND StressEvent-exe) @@ -42,7 +35,7 @@ set_target_properties( ) set_target_properties( OSSupport - PROPERTIES FOLDER Lib + PROPERTIES FOLDER Tests/Libraries ) diff --git a/tests/SchematicFileSerializer/CMakeLists.txt b/tests/SchematicFileSerializer/CMakeLists.txt index a431bee8e..3bee9ee0c 100644 --- a/tests/SchematicFileSerializer/CMakeLists.txt +++ b/tests/SchematicFileSerializer/CMakeLists.txt @@ -1,12 +1,7 @@ -cmake_minimum_required(VERSION 3.0.2) -enable_testing() - include_directories(${CMAKE_SOURCE_DIR}/src/) include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/lib/) include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -add_definitions(-DTEST_GLOBALS=1) - set (SHARED_SRCS ${CMAKE_SOURCE_DIR}/src/BiomeDef.cpp ${CMAKE_SOURCE_DIR}/src/BlockArea.cpp @@ -66,7 +61,7 @@ set (SRCS if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - add_flags_cxx("-Wno-error=global-constructors") + add_compile_options("-Wno-error=global-constructors") endif() diff --git a/tests/UUID/CMakeLists.txt b/tests/UUID/CMakeLists.txt index 384ebe1e5..f1d61e4a1 100644 --- a/tests/UUID/CMakeLists.txt +++ b/tests/UUID/CMakeLists.txt @@ -1,6 +1,3 @@ -cmake_minimum_required(VERSION 3.0.2) -enable_testing() - set (SHARED_SRCS ${CMAKE_SOURCE_DIR}/src/UUID.cpp ${CMAKE_SOURCE_DIR}/src/StringUtils.cpp |