• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
18file(GLOB SAMPLE_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
19add_executable(${SAMPLE_PROJECT} ${SAMPLE_SOURCES})
20add_executable(rxcpp::examples::${SAMPLE_PROJECT} ALIAS ${SAMPLE_PROJECT})
21target_compile_options(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_OPTIONS})
22target_compile_features(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_FEATURES})
23target_include_directories(${SAMPLE_PROJECT} PUBLIC ${RX_SRC_DIR} ${RX_CATCH_DIR})
24target_link_libraries(${SAMPLE_PROJECT} ${CMAKE_THREAD_LIBS_INIT})
25
26# configure unit tests via CTest
27enable_testing()
28set(CTEST_CONFIGURATION_TYPE "${JOB_BUILD_CONFIGURATION}")
29
30add_test(NAME RunTests
31     WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
32     COMMAND ${SAMPLE_PROJECT} ${TEST_ARGS})
33