forked from fumiama/base16384
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
39 lines (32 loc) · 1.23 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
cmake_minimum_required(VERSION 3.0.0)
project(base16384 VERSION 2.2.0)
SET(CMAKE_BUILD_TYPE "Release")
add_executable(base16384_b base16384.c)
include(TestBigEndian)
test_big_endian(isBigEndian)
if (${isBigEndian})
add_definitions(-DWORDS_BIGENDIAN)
endif()
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
add_library(base16384 SHARED file.c base1464.c)
add_library(base16384_s STATIC file.c base1464.c)
ELSE()
add_library(base16384 SHARED file.c base1432.c)
add_library(base16384_s STATIC file.c base1432.c)
ENDIF()
if (MSVC)
# do nothing
else()
# add hardening
target_compile_options(base16384 PUBLIC -Wl,-z,now -Wdate-time)
add_definitions(-D_FORTIFY_SOURCE=2)
endif()
set_target_properties(base16384_b PROPERTIES OUTPUT_NAME base16384)
set_target_properties(base16384_s PROPERTIES OUTPUT_NAME base16384)
set_target_properties(base16384 PROPERTIES VERSION ${CMAKE_PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR})
target_link_libraries(base16384_b base16384_s)
INSTALL(TARGETS base16384_b RUNTIME DESTINATION bin)
INSTALL(TARGETS base16384 LIBRARY DESTINATION lib)
INSTALL(TARGETS base16384_s ARCHIVE DESTINATION lib)
INSTALL(FILES base16384.h DESTINATION include)
INSTALL(FILES base16384.1 DESTINATION share/man/man1)