Home | History | Annotate | Download | only in CMake
      1 FIND_PACKAGE(Threads)
      2 
      3 option(RX_USE_EXCEPTIONS "Use C++ exceptions" ON)
      4 
      5 # define some compiler settings
      6 
      7 MESSAGE( STATUS "CMAKE_CXX_COMPILER_ID: " ${CMAKE_CXX_COMPILER_ID} )
      8 
      9 if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
     10     MESSAGE( STATUS "clang compiler version: " ${CMAKE_CXX_COMPILER_VERSION} )
     11     MESSAGE( STATUS "using clang settings" )
     12     set(RX_COMPILE_OPTIONS
     13         -Wall -Wextra -Werror -Wunused
     14         -stdlib=libc++
     15         -Wno-error=unused-command-line-argument
     16         -ftemplate-depth=1024
     17         )
     18     if (NOT RX_USE_EXCEPTIONS)
     19         MESSAGE( STATUS "no exceptions" )
     20         list(APPEND RX_COMPILE_OPTIONS -fno-exceptions)
     21     endif()
     22 elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
     23     MESSAGE( STATUS "gnu compiler version: " ${CMAKE_CXX_COMPILER_VERSION} )
     24     MESSAGE( STATUS "using gnu settings" )
     25     set(RX_COMPILE_OPTIONS
     26         -Wall -Wextra -Werror -Wunused
     27         )
     28     if (NOT RX_USE_EXCEPTIONS)
     29         MESSAGE( STATUS "no exceptions" )
     30         list(APPEND RX_COMPILE_OPTIONS -fno-exceptions)
     31     endif()
     32   elseif (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
     33     MESSAGE( STATUS "msvc compiler version: " ${CMAKE_CXX_COMPILER_VERSION} )
     34     MESSAGE( STATUS "using msvc settings" )
     35     set(RX_COMPILE_OPTIONS
     36         /W4 /WX
     37         /wd4503 # truncated symbol
     38         /wd4702 # unreachable code
     39         /bigobj
     40         /DUNICODE /D_UNICODE # it is a new millenium
     41         )
     42     if (NOT RX_USE_EXCEPTIONS)
     43         MESSAGE( STATUS "no exceptions" )
     44         list(APPEND RX_COMPILE_OPTIONS /EHs-c-)
     45     endif()
     46     if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "19.0.23506.0")
     47         MESSAGE( STATUS "with coroutines" )
     48         list(APPEND RX_COMPILE_OPTIONS
     49             /await # enable coroutines
     50             )
     51     endif()
     52 endif()
     53 
     54 set(RX_COMPILE_FEATURES
     55     cxx_auto_type
     56     cxx_nullptr
     57     cxx_decltype
     58     cxx_lambdas
     59     cxx_range_for
     60     cxx_right_angle_brackets
     61     cxx_rvalue_references
     62     cxx_static_assert
     63     cxx_trailing_return_types
     64     cxx_alias_templates
     65     cxx_variadic_templates
     66     cxx_template_template_parameters
     67     )
     68 
     69 set(IX_SRC_DIR ${RXCPP_DIR}/Ix/CPP/src)
     70 set(RX_SRC_DIR ${RXCPP_DIR}/Rx/v2/src)
     71 set(RX_CATCH_DIR ${RXCPP_DIR}/ext/catch/single_include/catch2)
     72