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