1cmake_minimum_required(VERSION 2.8)
2
3get_filename_component(SAMPLE_PROJECT "${CMAKE_CURRENT_SOURCE_DIR}" NAME)
4
5project(${SAMPLE_PROJECT})
6
7FIND_PACKAGE(Threads)
8
9MESSAGE( STATUS "CMAKE_CXX_COMPILER_ID: " ${CMAKE_CXX_COMPILER_ID} )
10if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
11    MESSAGE( STATUS "using clang settings" )
12    add_compile_options( -Wall -Wextra -Werror )
13    add_compile_options( -std=c++11 -stdlib=libc++ )
14    add_compile_options( -ftemplate-depth=1024 ) # sometimes you just do what the compiler tells you
15elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
16    MESSAGE( STATUS "using gnu settings" )
17    add_compile_options( -Wall -Wextra -Werror )
18    add_compile_options( -std=c++11 )
19elseif (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
20    MESSAGE( STATUS "using msvc settings" )
21    add_compile_options( /W4 /WX )
22    add_compile_options( /wd4503 ) # truncated symbol
23    add_compile_options( /wd4702 ) # unreachable code
24    add_compile_options( /wd4091 ) # typedef ignored on left when no variable is declared
25    add_compile_options( /bigobj )
26    add_definitions( /DUNICODE /D_UNICODE ) # it is a new millenium
27endif()
28
29
30# define some folders
31get_filename_component(RXCPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PATH)
32get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
33get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
34get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
35
36MESSAGE( STATUS "RXCPP_DIR: " ${RXCPP_DIR} )
37
38include_directories(SYSTEM ${RXCPP_DIR}/ext/catch/include)
39include_directories(${RXCPP_DIR}/Ix/CPP/src ${RXCPP_DIR}/Rx/v2/src)
40
41# define the sources
42set(SAMPLE_SOURCES
43    ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
44)
45add_executable(${SAMPLE_PROJECT} WIN32 ${SAMPLE_SOURCES})
46TARGET_LINK_LIBRARIES(${SAMPLE_PROJECT} ${CMAKE_THREAD_LIBS_INIT})
47
48# configure unit tests via CTest
49enable_testing()
50set(CTEST_CONFIGURATION_TYPE "${JOB_BUILD_CONFIGURATION}")
51
52add_test(NAME RunTests
53     WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
54     COMMAND ${SAMPLE_PROJECT} ${TEST_ARGS})