blob: 11d4d94c0f332a4094a1b979da1976880ab3fcd9 (
plain) (
blame)
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
|
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
option(AES_TOOLS_ASM "Use the 32-bit ASM implementation")
option(AES_TOOLS_ASM64 "Use the 64-bit ASM implementation")
file(GLOB_RECURSE aes_include CONFIGURE_DEPENDS "include/*.h")
file(GLOB aes_src CONFIGURE_DEPENDS "src/*.c")
if(MSVC AND AES_TOOLS_ASM)
enable_language(ASM_MASM)
file(GLOB aes_src_impl CONFIGURE_DEPENDS "src/asm/*.asm")
set_source_files_properties(${aes_src_impl} PROPERTIES COMPILE_FLAGS /safeseh)
# Setting CMAKE_ASM_MASM_FLAGS doesn't work: http://www.cmake.org/Bug/view.php?id=14711
elseif(MSVC AND AES_TOOLS_ASM64)
enable_language(ASM_MASM)
file(GLOB aes_src_impl CONFIGURE_DEPENDS "src/asm64/*.asm")
else()
file(GLOB aes_src_impl CONFIGURE_DEPENDS "src/c/*.c")
endif()
add_library(aes ${aes_include} ${aes_src} ${aes_src_impl})
target_include_directories(aes PUBLIC include/)
if(MSVC)
target_compile_definitions(aes PRIVATE _CRT_SECURE_NO_WARNINGS)
endif()
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
target_compile_options(aes PUBLIC -mssse3 -maes)
endif()
install(TARGETS aes ARCHIVE DESTINATION lib)
install(DIRECTORY include/aes DESTINATION include)
|