mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2025-12-12 12:22:12 +00:00
* Rename the library under test from src to GildedRoseLib. * Move the lib folder to test/third_party and handle ApprovalTests.hpp as header-only dependency. * Remove the superfluous googletest_approval_main.cpp (in the same sense as there is only one GildedRoseCatch2ApprovalTests.cc) * Set USE_FOLDERS property such that target ALL_BUILD, RUN_TESTS and ZERO_CHECK are grouped for Visual Studio. * Set WORKING_DIRECTORY such that the RUN_TESTS target works successfully. * Fix C++ language standard for Catch2 v3 to C++14. * Bump third-party dependencies * Update ApprovalTests.hpp to v10.13.0 * Update Catch2 to v3.8.0 * Update GTest to v1.16.0
21 lines
922 B
CMake
21 lines
922 B
CMake
set(TEST_NAME GildedRoseCatch2ApprovalTests)
|
|
add_executable(${TEST_NAME})
|
|
target_sources(${TEST_NAME} PRIVATE GildedRoseCatch2ApprovalTests.cc)
|
|
target_include_directories(${TEST_NAME} PUBLIC ../third_party)
|
|
target_link_libraries(${TEST_NAME} GildedRoseLib Catch2::Catch2 Catch2::Catch2WithMain)
|
|
set_property(TARGET ${TEST_NAME} PROPERTY CXX_STANDARD 14)
|
|
add_test(
|
|
NAME ${TEST_NAME}
|
|
COMMAND ${TEST_NAME}
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
)
|
|
|
|
# Set compiler option /FC for Visual Studio to to make the __FILE__ macro expand to full path.
|
|
# The __FILE__ macro is used by Catch2 to get the path to current test file.
|
|
# Links:
|
|
# * https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=vs-2019
|
|
# * https://docs.microsoft.com/en-us/cpp/build/reference/fc-full-path-of-source-code-file-in-diagnostics?view=vs-2019
|
|
if (MSVC)
|
|
target_compile_options(${TEST_NAME} PRIVATE "/FC")
|
|
endif()
|