-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
43 lines (30 loc) · 1.44 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
cmake_minimum_required(VERSION 3.14...3.20)
project(MathFunctionsStandalone LANGUAGES CXX)
# --- Import tools ----
include(../cmake/tools.cmake)
# ---- Dependencies ----
include(../cmake/CPM.cmake)
CPMAddPackage(
NAME fmt
GIT_TAG 7.1.3
GITHUB_REPOSITORY fmtlib/fmt # to get an installable target
OPTIONS "FMT_INSTALL YES"
)
CPMAddPackage(NAME MathFunctions SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/..)
# Not same as! add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/.. MathFunctions)
# ---- Create standalone executable ----
add_executable(MathFunctionsCalculator source/calc.cxx)
set_target_properties(MathFunctionsCalculator PROPERTIES CXX_STANDARD ${CMAKE_CXX_STANDARD})
target_link_libraries(MathFunctionsCalculator MathFunctions::MathFunctions fmt::fmt)
add_executable(MathFunctionsStandalone source/main.cxx)
set_target_properties(MathFunctionsStandalone PROPERTIES CXX_STANDARD ${CMAKE_CXX_STANDARD})
target_link_libraries(
MathFunctionsStandalone MathFunctions::Addition MathFunctions::SquareRoot fmt::fmt
)
# ---- run the standalone executable ----
enable_testing()
add_test(NAME MathFunctionsCalculator COMMAND MathFunctionsCalculator 2)
add_test(NAME MathFunctionsStandaloneHint COMMAND MathFunctionsStandalone)
add_test(NAME MathFunctionsStandaloneOops COMMAND MathFunctionsStandalone Oops ...)
add_test(NAME MathFunctionsStandalone COMMAND MathFunctionsStandalone 49.0)
add_test(NAME MathFunctionsStandaloneNaN COMMAND MathFunctionsStandalone -1)