-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
45 lines (33 loc) · 1.14 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
44
45
cmake_minimum_required(VERSION 3.9)
project(creditCardValidator VERSION 1.0.0 DESCRIPTION "mylib description")
include(GNUInstallDirs)
SET(NAME "creditCardValidator")
SET(TEST_NAME "test_creditCardValidator")
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install)
SET(SRC
src/CreditCardValidator.cpp
)
SET(HEADER
include/CreditCardValidator.hpp
)
add_library(${NAME} SHARED ${SRC})
set_target_properties(${NAME} PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
PUBLIC_HEADER ${HEADER})
target_include_directories(${NAME} PUBLIC include/)
install(TARGETS ${NAME}
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR})
include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.11.0
)
FetchContent_MakeAvailable(googletest)
add_executable(${TEST_NAME} tests/CreditCardValidatorTest.cpp)
target_link_libraries(${TEST_NAME} PUBLIC gtest_main ${NAME})
include(CTest)
include(GoogleTest)
gtest_discover_tests(${TEST_NAME})