Skip to content

Commit

Permalink
fix: fixed unittest for mac, ctest now works (#1001)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaskowicz1 authored Nov 13, 2023
1 parent ff88a82 commit 42ab7e5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ config.json
.misspell-fixer.ignore
compile_commands.json
src/dpp/dpp.rc
.DS_STORE
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ if (NOT DPP_NO_VCPKG AND EXISTS "${_VCPKG_ROOT_DIR}")
HOMEPAGE_URL "https://dpp.dev/"
DESCRIPTION "An incredibly lightweight C++ Discord library."
)

# Required before we add any subdirectories.
if (DPP_BUILD_TEST)
enable_testing(${CMAKE_CURRENT_SOURCE_DIR})
endif()

add_subdirectory(library-vcpkg)
else()
set(PROJECT_NAME "libdpp")
Expand All @@ -79,6 +85,12 @@ else()
HOMEPAGE_URL "https://dpp.dev/"
DESCRIPTION "An incredibly lightweight C++ Discord library."
)

# Required before we add any subdirectories.
if (DPP_BUILD_TEST)
enable_testing(${CMAKE_CURRENT_SOURCE_DIR})
endif()

add_subdirectory(library)
endif()

Expand Down
5 changes: 2 additions & 3 deletions library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,8 @@ if (DPP_BUILD_TEST)
endif()
endforeach()
add_test(
NAME unittests
COMMAND library/unittest
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/library
NAME unittest
COMMAND unittest
)
endif()

Expand Down
2 changes: 2 additions & 0 deletions src/unittest/test.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ _Pragma("warning( disable : 5105 )"); // 4251 warns when we export classes or st

#ifdef _WIN32
#define SHARED_OBJECT "dpp.dll"
#elif __APPLE__
#define SHARED_OBJECT "libdpp.dylib"
#else
#define SHARED_OBJECT "libdpp.so"
#endif
Expand Down

0 comments on commit 42ab7e5

Please sign in to comment.