1cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
2
3get_filename_component(SAMPLE_PROJECT "${CMAKE_CURRENT_SOURCE_DIR}" NAME)
4
5project(${SAMPLE_PROJECT} LANGUAGES C CXX)
6
7# define some folders
8get_filename_component(RXCPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PATH)
9get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
10get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
11get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
12
13MESSAGE( STATUS "RXCPP_DIR: " ${RXCPP_DIR} )
14
15include(${RXCPP_DIR}/projects/CMake/shared.cmake)
16
17# define the sources
18set(SAMPLE_SOURCES
19    ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
20    ${CMAKE_CURRENT_SOURCE_DIR}/take.cpp
21)
22add_executable(${SAMPLE_PROJECT} ${SAMPLE_SOURCES})
23add_executable(rxcpp::examples::${SAMPLE_PROJECT} ALIAS ${SAMPLE_PROJECT})
24target_compile_options(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_OPTIONS})
25target_compile_features(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_FEATURES})
26target_include_directories(${SAMPLE_PROJECT} PUBLIC ${RX_SRC_DIR} ${RX_CATCH_DIR})
27target_link_libraries(${SAMPLE_PROJECT} ${CMAKE_THREAD_LIBS_INIT})
28
29# configure unit tests via CTest
30enable_testing()
31set(CTEST_CONFIGURATION_TYPE "${JOB_BUILD_CONFIGURATION}")
32
33set_target_properties(${SAMPLE_PROJECT} PROPERTIES FOLDER "Examples")
34
35add_test(NAME RunTests
36     WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
37     COMMAND ${SAMPLE_PROJECT} ${TEST_ARGS})
38