fixed cmakelists.txt

This commit is contained in:
Jonas Zeunert
2018-07-10 22:17:34 +02:00
parent b164bb2ee9
commit 40d1b629fc
2 changed files with 17 additions and 3 deletions

View File

@@ -6,7 +6,7 @@ set(DEFAULT_BUILD_TYPE Debug)
set(CMAKE_CXX_STANDARD 17)
# Boost configuration
set(BOOST_COMPONENTS program_options)
set(BOOST_COMPONENTS program_options thread timer chrono)
###################### START_CMAKE #######################
cmake_minimum_required(VERSION 3.9.1)
@@ -23,7 +23,7 @@ if(NOT CMAKE_BUILD_TYPE)
endif(NOT CMAKE_BUILD_TYPE)
option(BUILD_SHARED_LIB "Build a shared lib instead of a static." OFF)
option(ENABLE_TESTING "Enables testing." OFF)
option(ENABLE_TESTING "Enables testing." ON)
#################### Adding Library #####################
file(GLOB_RECURSE SOURCES src/*.cpp)
@@ -59,7 +59,21 @@ endif()
target_link_libraries(${PROJECT_NAME} PUBLIC ${WIRING_PI})
## EASYLOGGING
set(EASYLOGGING_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/${LIB_DIR}/easylogging)
add_library(Easylogging STATIC ${EASYLOGGING_INCLUDE_DIR}/easylogging++.cc)
target_include_directories(${PROJECT_NAME} PRIVATE ${EASYLOGGING_INCLUDE_DIR})
target_link_libraries(${PROJECT_NAME} PUBLIC Easylogging)
## CATCH
set(CATCH_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/tests)
add_library(Catch INTERFACE)
target_include_directories(Catch INTERFACE ${CATCH_INCLUDE_DIR})
## THREAD
find_package(Threads REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE ${Threads_LIBRARIES})
if(ENABLE_TESTING)
add_subdirectory(tests)
endif(ENABLE_TESTING)