56 lines
1.3 KiB
CMake
56 lines
1.3 KiB
CMake
cmake_minimum_required(VERSION 3.27)
|
|
project(CalculatorChallenge CXX)
|
|
|
|
set(CMAKE_CXX_STANDARD 23)
|
|
set(CMAKE_CXX_EXTENSIONS ON)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
|
|
|
INCLUDE(FetchContent)
|
|
|
|
FetchContent_Declare(
|
|
fmtformat
|
|
GIT_REPOSITORY https://github.com/fmtlib/fmt
|
|
GIT_TAG 10.2.1
|
|
)
|
|
FetchContent_MakeAvailable(fmtformat)
|
|
|
|
FetchContent_Declare(
|
|
Catch2
|
|
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
|
GIT_TAG v3.5.3
|
|
)
|
|
FetchContent_MakeAvailable(Catch2)
|
|
list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/extras)
|
|
include(CTest)
|
|
include(Catch)
|
|
|
|
if(APPLE)
|
|
set(CMAKE_C_COMPILER /opt/homebrew/Cellar/llvm@16/16.0.6/bin/clang)
|
|
set(CMAKE_CXX_COMPILER /opt/homebrew/Cellar/llvm@16/16.0.6/bin/clang++)
|
|
endif()
|
|
|
|
SET(CALCULATOR_CHALLENGE_SOURCES
|
|
Calculator.cpp
|
|
CalculatorCli.cpp
|
|
utils.cpp
|
|
)
|
|
|
|
add_executable(calculator-challege
|
|
main.cpp
|
|
${CALCULATOR_CHALLENGE_SOURCES}
|
|
)
|
|
target_link_libraries(calculator-challege PRIVATE fmt::fmt)
|
|
|
|
|
|
add_executable(calculator-challege-tests
|
|
CalculatorTests.cpp
|
|
BinaryOperatorFactoryTests.cpp
|
|
CalculatorCliTests.cpp
|
|
${CALCULATOR_CHALLENGE_SOURCES}
|
|
)
|
|
target_link_libraries(calculator-challege-tests PRIVATE Catch2::Catch2WithMain fmt::fmt)
|
|
catch_discover_tests(calculator-challege-tests)
|