-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
65 lines (49 loc) · 2.38 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
58
59
60
61
62
63
64
#To "produce" a working binary, i.e., program, run the following two commands in the shell.
#cmake -H. -Bbuild
#cmake --build build -- -j3
cmake_minimum_required (VERSION 2.8)
project (LE_1dim_reflect)
# do we want static libraries?
# When STATIC_LINKING is set, cmake looks for libraries called *.a.
if(STATIC_LINKING)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
endif(STATIC_LINKING)
# Gnu compiler setup
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
message("using Gnu compiler")
# use C++ 2011 standard
set (CMAKE_CXX_FLAGS "-std=c++11")
# optimization
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftree-vectorize")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffast-math")
# parallelization
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
# warnings
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") #-Wall does not give all error massages, so one needs the other -W... options
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-pragmas")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wmissing-declarations")
else()
message(SEND_ERROR
"currently no other compiler than the GCC is supported. sorry.")
endif()
find_package(Eigen3 REQUIRED) #Needed in script
include_directories (${EIGEN3_INCLUDE_DIR})
set(SRCS LE_1dim_reflect.cpp) # Add here names of cource files
set(LIBS ${Boost_LIBRARIES})
set (PROGNAME LE_1dim_reflect)
# Signalword "cuda" nedded if CUDA code inclueded
add_executable(${PROGNAME} ${SRCS})
target_link_libraries(${PROGNAME} ${LIBS})
# set -static, when STATIC_LINKING is TRUE and set LINK_SEARCH_END_STATIC
# to remove the additional -bdynamic from the linker line.
if(STATIC_LINKING)
set(CMAKE_EXE_LINKER_FLAGS "-static")
set_target_properties(${PROGNAME} PROPERTIES LINK_SEARCH_END_STATIC 1)
endif(STATIC_LINKING)
install(TARGETS ${PROGNAME} RUNTIME DESTINATION .)
# create source-doc with doxygen
add_custom_target(doc
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMAND doxygen doxygen.config)