This repository has been archived by the owner on Oct 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
CMakeLists.txt
56 lines (45 loc) · 1.9 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Copyright (C) 2016 D Levin (http://www.kfrlib.com)
# This file is part of KFR
#
# KFR is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# KFR is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with KFR.
cmake_minimum_required(VERSION 3.0)
set(OPT_BITNESS "") # cmake -DOPT_BITNESS="-m32" or -m64
set(OPT_STATIC "") # cmake -DOPT_STATIC="-static"
if (CMAKE_BUILD_TYPE_INITIALIZED_TO_DEFAULT)
set(CMAKE_BUILD_TYPE Release)
endif ()
if (${CMAKE_GENERATOR} STREQUAL "MinGW Makefiles" OR ${CMAKE_GENERATOR} STREQUAL "MSYS Makefiles")
set(OPT_TARGET "--target=x86_64-w64-windows-gnu")
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_C_COMPILER clang)
else ()
set(OPT_TARGET "") # default target
endif ()
if (${CMAKE_GENERATOR} STREQUAL "Visual Studio 14 2015")
set(CMAKE_GENERATOR_TOOLSET LLVM-vs2014)
endif ()
set(CMAKE_CXX_FLAGS "${OPT_TARGET} ${OPT_BITNESS} ${OPT_STATIC}" CACHE STRING "compile flags" FORCE)
set(CMAKE_C_FLAGS "${OPT_TARGET} ${OPT_BITNESS} ${OPT_STATIC}" CACHE STRING "compile flags" FORCE)
#set(CMAKE_EXE_LINKER_FLAGS "${OPT_TARGET} ${OPT_BITNESS}")
#set(CMAKE_SHARED_LINKER_FLAGS "${OPT_TARGET} ${OPT_BITNESS}")
#set(CMAKE_STATIC_LINKER_FLAGS "${OPT_TARGET} ${OPT_BITNESS}")
project(kfr)
include(sources.cmake)
set(ALL_WARNINGS -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-c99-extensions -Wno-padded)
if (NOT MSVC)
add_compile_options(-std=c++1y)
else ()
add_compile_options(/EHsc /D_HAS_EXCEPTIONS=0)
endif ()
add_subdirectory(tests)