aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/aes/CMakeLists.txt
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2019-12-21 13:33:50 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2019-12-21 13:33:50 +0300
commit351c5188013fff041c7217aed64478cfc7643480 (patch)
treec918b5093ac45394439f3dff30da37b809173603 /aes/CMakeLists.txt
parentcmake: install libraries & their headers (diff)
downloadaes-tools-351c5188013fff041c7217aed64478cfc7643480.tar.gz
aes-tools-351c5188013fff041c7217aed64478cfc7643480.zip
restructure the project
Diffstat (limited to 'aes/CMakeLists.txt')
-rw-r--r--aes/CMakeLists.txt28
1 files changed, 28 insertions, 0 deletions
diff --git a/aes/CMakeLists.txt b/aes/CMakeLists.txt
new file mode 100644
index 0000000..0ec262d
--- /dev/null
+++ b/aes/CMakeLists.txt
@@ -0,0 +1,28 @@
+option(AES_TOOLS_ASM "Use the assembly language implementation instead of the one in C")
+
+file(GLOB_RECURSE aes_include "include/*.h")
+
+if(MSVC AND AES_TOOLS_ASM)
+ enable_language(ASM_MASM)
+ file(GLOB aes_src_c "src/*.c")
+ file(GLOB aes_src_asm "src/asm/*.asm")
+ set(aes_src ${aes_src_asm} ${aes_src_c})
+ set_source_files_properties(${aes_src_asm} PROPERTIES COMPILE_FLAGS /safeseh)
+ # Setting CMAKE_ASM_MASM_FLAGS doesn't work: http://www.cmake.org/Bug/view.php?id=14711
+else()
+ file(GLOB_RECURSE aes_src "src/*.c")
+endif()
+
+add_library(aes ${aes_src} ${aes_include})
+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)