write present mode fallback messages only once
[kazan.git] / CMakeLists.txt
1 # Copyright 2017 Jacob Lifshay
2 #
3 # Permission is hereby granted, free of charge, to any person obtaining a copy
4 # of this software and associated documentation files (the "Software"), to deal
5 # in the Software without restriction, including without limitation the rights
6 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 # copies of the Software, and to permit persons to whom the Software is
8 # furnished to do so, subject to the following conditions:
9 #
10 # The above copyright notice and this permission notice shall be included in all
11 # copies or substantial portions of the Software.
12 #
13 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 # SOFTWARE.
20 #
21 cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
22
23 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
24
25 set(CMAKE_CXX_STANDARD 14)
26 set(CMAKE_CXX_STANDARD_REQUIRED ON)
27 set(CMAKE_C_VISIBILITY_PRESET hidden)
28 set(CMAKE_CXX_VISIBILITY_PRESET hidden)
29 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
30
31 project(kazan CXX C)
32 if(NOT ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
33 message(FATAL_ERROR "compiler is not clang")
34 endif()
35 if(NOT ${CMAKE_C_COMPILER_ID} MATCHES "Clang")
36 message(FATAL_ERROR "compiler is not clang")
37 endif()
38
39 find_package(LLVM REQUIRED CONFIG)
40 if(LLVM_PACKAGE_VERSION VERSION_LESS 4.0)
41 message(FATAL_ERROR "unsupported version of llvm; requires version 4.0 or greater")
42 endif()
43 if(NOT LLVM_ENABLE_THREADS)
44 message(FATAL_ERROR "llvm was not built multi-threaded")
45 endif()
46 include_directories(${LLVM_INCLUDE_DIRS})
47 add_definitions(${LLVM_DEFINITIONS})
48 set(CMAKE_THREAD_PREFER_PTHREAD 1)
49 set(THREADS_PREFER_PTHREAD_FLAG 1)
50 find_package(Threads REQUIRED)
51 if(WIN32)
52 add_definitions(NOMINMAX)
53 endif()
54 add_compile_options(-Wall -ftemplate-depth=1024 -Werror "-Wno-error=#warnings")
55 add_subdirectory(src)