Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ build/
*.swp
compile_commands.json
.vscode/
.idea
cmake-build-debug
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
cmake_minimum_required(VERSION 3.14)
project(dense_hash_map)

string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}" is_top_level)
option(DENSE_HASH_MAP_BUILD_TEST "Build Dense Hash Map tests" ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
Expand All @@ -9,5 +11,7 @@ add_library(dense_hash_map INTERFACE)
target_include_directories(dense_hash_map INTERFACE include/)
add_library(JGuegant::dense_hash_map ALIAS dense_hash_map)

add_subdirectory(thirdparty/catch2)
add_subdirectory(tests)
if (is_top_level OR ${DENSE_HASH_MAP_BUILD_TEST})
add_subdirectory(thirdparty/catch2_ext)
add_subdirectory(tests)
endif()
4 changes: 2 additions & 2 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ project(dense_hash_map_tests)
option(ENABLE_ASAN "Enable ASAN during the tests" OFF)
option(ENABLE_UBASAN "Enable UBASAN during the tests" OFF)

add_executable(dense_hash_map_tests src/dense_hash_map_tests)
target_link_libraries(dense_hash_map_tests Catch2::Catch2)
add_executable(dense_hash_map_tests src/dense_hash_map_tests.cpp)
target_link_libraries(dense_hash_map_tests Catch2::Catch2WithMain)
target_link_libraries(dense_hash_map_tests dense_hash_map)

if(MSVC)
Expand Down
2 changes: 1 addition & 1 deletion tests/src/dense_hash_map_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file

#include "catch2/catch.hpp"
#include <catch2/catch_test_macros.hpp>
#include "jg/dense_hash_map.hpp"
#include "jg/details/type_traits.hpp"

Expand Down
1 change: 0 additions & 1 deletion thirdparty/catch2
Submodule catch2 deleted from 59d2d0
12 changes: 12 additions & 0 deletions thirdparty/catch2_ext/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
include(FetchContent)
FetchContent_Declare(
Catch2
GIT_SHALLOW TRUE
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v3.6.0)
FetchContent_MakeAvailable(Catch2)

# For catch 2 only
list(APPEND CMAKE_MODULE_PATH ${Catch2_SOURCE_DIR}/contrib)
# For catch 3 only
# list(APPEND CMAKE_MODULE_PATH ${Catch2_SOURCE_DIR}/extras)