-
Notifications
You must be signed in to change notification settings - Fork 49
/
CMakeLists.txt
51 lines (40 loc) · 1.32 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
cmake_minimum_required(VERSION 3.5)
project(cm256)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
option(MARCH_NATIVE "Use -march=native option" ON)
set(LIB_SOURCE_FILES
src/cm256.cpp
include/cm256.h
src/gf256.cpp
include/gf256.h
)
set(UNIT_TEST_SOURCE_FILES
unit_test/main.cpp
unit_test/SiameseTools.cpp
unit_test/SiameseTools.h
)
if(MSVC)
else()
set(CMAKE_CXX_FLAGS "-Wall -Wextra")
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
endif()
if(MARCH_NATIVE)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -march=native")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -march=native")
endif()
add_library(cm256 ${LIB_SOURCE_FILES})
set_target_properties(cm256 PROPERTIES VERSION 2)
set_target_properties(cm256 PROPERTIES SOVERSION 2)
target_include_directories(cm256 PUBLIC ${PROJECT_SOURCE_DIR}/include)
add_executable(unit_test ${UNIT_TEST_SOURCE_FILES})
target_link_libraries(unit_test cm256)
install(TARGETS cm256
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(DIRECTORY include DESTINATION ${CMAKE_INSTALL_PREFIX})