-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
37 lines (26 loc) · 979 Bytes
/
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
cmake_minimum_required(VERSION 3.8)
project(cpp-expression-tests CXX)
set(CMAKE_CXX_STANDARD 20)
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fconcepts")
endif()
find_package(Catch2 QUIET)
if (NOT TARGET Catch2::Catch2)
if (NOT EXISTS ${PROJECT_SOURCE_DIR}/catch.hpp)
message(STATUS "Downloading catch...")
file(DOWNLOAD https://github.com/catchorg/Catch2/releases/download/v2.9.2/catch.hpp
${PROJECT_SOURCE_DIR}/catch.hpp
STATUS CATCH_STATUS)
list(GET CATCH_STATUS 0 CATCH_RESULT)
if (${CATCH_RESULT} EQUAL 0)
message(STATUS "OK")
else()
list(GET CATCH_STATUS 1 CATCH_ERROR)
message(FATAL_ERROR "Error " ${CATCH_ERROR})
endif()
endif()
endif()
add_executable(cpp-expression-test test.cpp)
if (TARGET Catch2::Catch2)
target_link_libraries(cpp-expression-test Catch2::Catch2)
endif()