generated from Shahabaz-Bagwan/templateRepo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
39 lines (28 loc) · 1.19 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
# min. version of cmake required for this project
cmake_minimum_required(VERSION 3.10)
# name of the project
project(Logger)
# Required to use vim as cpp ide
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/build/bin)
set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/build/lib)
# specify the C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# collect all the .cxx needed for executable
file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
add_subdirectory(thirdparty/fmt)
add_subdirectory(example)
# Create library
add_library(${PROJECT_NAME}_shared SHARED ${SOURCES})
target_link_libraries(${PROJECT_NAME}_shared PUBLIC fmt::fmt)
target_include_directories(
${PROJECT_NAME}_shared
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/fmt/include
${CMAKE_CURRENT_SOURCE_DIR}/include)
add_library(${PROJECT_NAME}_static STATIC ${SOURCES})
target_link_libraries(${PROJECT_NAME}_static PUBLIC fmt::fmt)
target_include_directories(
${PROJECT_NAME}_static PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/fmt/include
${CMAKE_CURRENT_SOURCE_DIR}/include)