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) 21add_executable(${SAMPLE_PROJECT} ${SAMPLE_SOURCES}) 22add_executable(rxcpp::examples::${SAMPLE_PROJECT} ALIAS ${SAMPLE_PROJECT}) 23target_compile_options(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_OPTIONS}) 24target_compile_features(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_FEATURES}) 25target_include_directories(${SAMPLE_PROJECT} PUBLIC ${RX_SRC_DIR}) 26target_link_libraries(${SAMPLE_PROJECT} ${CMAKE_THREAD_LIBS_INIT}) 27 28# configure unit tests via CTest 29enable_testing() 30set(CTEST_CONFIGURATION_TYPE "${JOB_BUILD_CONFIGURATION}") 31 32set_target_properties(${SAMPLE_PROJECT} PROPERTIES FOLDER "Examples") 33 34add_test(NAME RunTests 35 WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" 36 COMMAND ${SAMPLE_PROJECT} ${TEST_ARGS}) 37