-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
50 lines (44 loc) · 1.63 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
cmake_minimum_required(VERSION 2.6)
project(ETSL CXX)
set(ETSL_VERSION_MAJOR 1)
set(ETSL_VERSION_MINOR 0)
include(CheckCXXCompilerFlag)
if(${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC)
# Avoid the variadic template bugs in MSVC.
add_definitions(-DBOOST_NO_CXX11_VARIADIC_TEMPLATES)
else()
check_cxx_compiler_flag("-std=c++14" COMPILER_SUPPORTS_CXX14)
check_cxx_compiler_flag("-std=c++1y" COMPILER_SUPPORTS_CXX1Y)
if(COMPILER_SUPPORTS_CXX14)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
elseif(COMPILER_SUPPORTS_CXX1Y)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")
else()
message(FATAL_ERROR
"The compiler ${CMAKE_CXX_COMPILER} has no C++14 support."
"Please use a different C++ compiler.")
endif()
if(${CMAKE_CXX_COMPILER_ID} STREQUAL Clang)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra -pedantic")
endif()
#-------------------------------------------------------------------------------
# Line Count
#-------------------------------------------------------------------------------
add_custom_target(count
find src \\\( -name "*.hpp" -or -name "*.cpp" \\\)
-print0 | xargs -0 wc -l
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
#-------------------------------------------------------------------------------
# etsl
#-------------------------------------------------------------------------------
file(GLOB_RECURSE ETSL_SRC_FILES
"src/*.hpp"
"src/*.cpp"
)
add_executable(etsl
${ETSL_SRC_FILES}
)