-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
32 lines (23 loc) · 1.04 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
# @@@ Define CMake parameters (1) @@@
cmake_minimum_required(VERSION 3.10)
# Define variables
set(PROJECT_SRC_DIR src)
set(PROJECT_LIBS_DIR libs)
set(PROJECT_NAME TestCMake)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# @@@ Define project info (2) @@@
project(${PROJECT_NAME} VERSION 1.0.0)
# Use Config.h.in to create config.h in the “poject_build” dir (the build dir) (3)
configure_file(${PROJECT_SRC_DIR}/config.h.in ${PROJECT_BINARY_DIR}/config.h)
# Add library (4)
add_subdirectory(${PROJECT_LIBS_DIR}/StaticLib)
# Project's executable (5)
add_executable(TestCMake ${PROJECT_SRC_DIR}/Main.cpp)
# Link library (6)
target_link_libraries(${PROJECT_NAME} PUBLIC StaticLib)
# Define includes (should be after add_executable) (7)
target_include_directories(TestCMake PUBLIC
"${PROJECT_BINARY_DIR}" # For using Config.h file
"${PROJECT_LIBS_DIR}/StaticLib" # No need to specify StaticLib/include explicitly to use <StaticLib.hpp>
)