-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
48 lines (35 loc) · 1001 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
38
39
40
41
42
43
44
45
46
47
48
cmake_minimum_required(VERSION 3.10)
project(shared_lib_cpp VERSION 0.0.1 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
option(ENABLE_TESTS "Enable tests" OFF)
include_directories(include)
set(SOURCES
src/Library.cpp
src/Foo.cpp
)
# Create shared library target
add_library(${PROJECT_NAME} SHARED ${SOURCES})
# Create static library target
#add_library(${PROJECT_NAME} STATIC ${SOURCES})
# --
# --
# target instructions must be after add_executable or add_library instructions
# Get the headers
set(INCLUDES include)
include_directories(PUBLIC ${INCLUDES})
target_include_directories(${PROJECT_NAME} PUBLIC ${INCLUDES})
# Define target properties
target_include_directories(${PROJECT_NAME}
PUBLIC
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
# PRIVATE
# ${CMAKE_CURRENT_SOURCE_DIR}/src # if headers here
)
if(ENABLE_TESTS)
enable_testing()
add_subdirectory(test)
elseif()
message("Tests not included")
endif()
# Install instructions