-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
58 lines (38 loc) · 1.54 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
56
57
# cmake file to build Diamonds
#
# Usage: ($ mkdir build)
# $ cd build
# $ cmake ..
# ($ make clean)
# $ make -j 4
#
# After a successful build you can safely remove all files and directories from build/
#
# Notes:
# - Prefer 'cmake ..' in the build/ directory above 'cmake' in the
# parent directory, because the former does an out-of-source build.
#
# - You can change the default compiler by using (e.g. on Mac OSX)"
# $ cmake -D CMAKE_CXX_COMPILER=/usr/bin/clang++ ..
project(Diamonds)
# cmake version shouldn't be too old
cmake_minimum_required(VERSION 2.8)
# Specify the location of the header files
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
# Specify the simulator source files to be compiled
file(GLOB sourceFiles ${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp)
# Set the compiler flags
# First those common to both gcc and clang:
# -O3 = level 3 optimization;
# -Wall = enable all compiler's warning messages
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -Wall")
# Then those specific for the compiler, for using C++11 support.
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -std=c++11 -Wno-deprecated-register")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
endif()
# Create a shared library target
add_library(diamonds SHARED ${sourceFiles})
# Install the library in the lib/ folder
install(TARGETS diamonds LIBRARY DESTINATION ${CMAKE_SOURCE_DIR}/lib)