1####################################################################################
2#                                                                                  #
3#  Copyright (c) 2014 - 2018 Axel Menzel <info@rttr.org>                           #
4#                                                                                  #
5#  This file is part of RTTR (Run Time Type Reflection)                            #
6#  License: MIT License                                                            #
7#                                                                                  #
8#  Permission is hereby granted, free of charge, to any person obtaining           #
9#  a copy of this software and associated documentation files (the "Software"),    #
10#  to deal in the Software without restriction, including without limitation       #
11#  the rights to use, copy, modify, merge, publish, distribute, sublicense,        #
12#  and/or sell copies of the Software, and to permit persons to whom the           #
13#  Software is furnished to do so, subject to the following conditions:            #
14#                                                                                  #
15#  The above copyright notice and this permission notice shall be included in      #
16#  all copies or substantial portions of the Software.                             #
17#                                                                                  #
18#  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR      #
19#  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,        #
20#  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE     #
21#  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER          #
22#  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,   #
23#  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE   #
24#  SOFTWARE.                                                                       #
25#                                                                                  #
26####################################################################################
27
28####################################################################################
29# Search and install 3rd party libraries
30#
31####################################################################################
32
33MESSAGE(STATUS ${LIBRARY_OUTPUT_DIRECTORY})
34MESSAGE(STATUS "Finding 3rd party libs...")
35MESSAGE(STATUS "===========================")
36
37if (BUILD_BENCHMARKS)
38    if (MSVC)
39        # there is a the moment a problem with finding multiple versions of boost,
40        # i.e. the static AND the static runtime version; that is not possible atm.
41        # Because of that, the benchmarks cannot be build with the static runtime lib option enabled
42        set(Boost_USE_STATIC_LIBS       ON)
43        set(Boost_USE_STATIC_RUNTIME    OFF)
44        set(BOOST_ALL_DYN_LINK          OFF)
45
46        find_package(Boost COMPONENTS chrono system)
47    else()
48        find_package(Boost)
49    endif()
50endif()
51
52if (BUILD_BENCHMARKS OR BUILD_EXAMPLES)
53    find_package(Threads REQUIRED)
54endif()
55
56find_package(RapidJSON REQUIRED)
57set(RAPID_JSON_DIR ${RapidJSON_INCLUDE_DIR})
58set(NONIUS_DIR ${RTTR_3RD_PARTY_DIR}/nonius-1.1.2)
59
60# Prepare "Catch" library for other executables
61set(CATCH_INCLUDE_DIR ${RTTR_3RD_PARTY_DIR}/catch-1.12.0)
62add_library(Catch INTERFACE)
63add_library(Catch2::Catch ALIAS Catch)
64target_include_directories(Catch INTERFACE ${CATCH_INCLUDE_DIR})
65
66# Find chai script
67find_package(PkgConfig REQUIRED)
68pkg_check_modules(_chaiscript REQUIRED chaiscript)
69set(CHAISCRIPT_INCLUDE_DIR ${_chaiscript_INCLUDEDIR})
70add_library(ChaiScript INTERFACE)
71add_library(ChaiScript::ChaiScript ALIAS ChaiScript)
72target_include_directories(ChaiScript INTERFACE ${CHAISCRIPT_INCLUDE_DIR})
73
74MESSAGE(STATUS "Finished finding 3rd party libs!")
75