Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
cmake_minimum_required(VERSION 3.15)
project(cpp_channel VERSION 1.3.1)

set(CMAKE_CXX_STANDARD 11 CACHE STRING "C++ standard")
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
include(warnings)

add_library(msd_channel INTERFACE)
target_include_directories(msd_channel INTERFACE include)
target_compile_features(msd_channel INTERFACE cxx_std_11)

option(CPP_CHANNEL_BUILD_TESTS "Build all of cpp_channel's own tests." OFF)
option(CPP_CHANNEL_BUILD_BENCHMARKS "Build all of cpp_channel's own benchmark tests." OFF)
Expand All @@ -18,6 +15,10 @@ option(CPP_CHANNEL_COVERAGE "Generate test coverage." OFF)
option(CPP_CHANNEL_SANITIZERS "Build with sanitizers." OFF)
option(CPP_CHANNEL_SANITIZE_THREADS "Build with thread sanitizer." OFF)

function(cpp_channel_configure_target TARGET)
set_target_properties(${TARGET} PROPERTIES CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF)
endfunction()

if(CPP_CHANNEL_BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
Expand Down
2 changes: 2 additions & 0 deletions benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ endif()

function(package_add_benchmark TESTNAME)
add_executable(${TESTNAME} ${ARGN})
cpp_channel_configure_target(${TESTNAME})

set_target_warnings(${TESTNAME} PRIVATE)
target_link_libraries(${TESTNAME} msd_channel benchmark)
endfunction()
Expand Down
1 change: 1 addition & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
function(add_example NAME)
add_executable(${NAME} ${ARGN})
cpp_channel_configure_target(${NAME})

set_target_warnings(${NAME} PRIVATE)
target_link_libraries(${NAME} msd_channel)
Expand Down
1 change: 1 addition & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ endif()
# Test macro
function(package_add_test TESTNAME)
add_executable(${TESTNAME} ${ARGN})
cpp_channel_configure_target(${TESTNAME})

set_target_warnings(${TESTNAME} PRIVATE)
target_link_libraries(${TESTNAME} msd_channel gtest gtest_main)
Expand Down
Loading