Mode 1

cmake_minimum_required(VERSION 3.19)
project(test_sha_aes)

set(CMAKE_CXX_STANDARD 14)

add_executable(main main.cpp sha/sha2.c aes/aes.c aes/aes_crypto.c)

Mode 2

cmake_minimum_required(VERSION 3.19)
project(test_sha_aes)
set(CMAKE_CXX_STANDARD 14)
add_executable(main main.cpp)

add_library(aes aes/aes_crypto.c aes/aes.c)
target_link_libraries(main aes)

add_library(sha sha/sha2.c)
target_link_libraries(main sha)

Reference

Cmakelists.txt添加.h和.cpp文件
https://blog.csdn.net/qq_39148922/article/details/111053624

CMakeLists.txt和.h头文件
https://blog.csdn.net/qq_38329197/article/details/86500071

CMakeLists.txt 语法介绍与实例演练(参考价值较小)
https://blog.csdn.net/afei__/article/details/81201039

CMake Tutorial
https://medium.com/@onur.dundar1/cmake-tutorial-585dd180109b

posted on 2023-03-03 14:39  Mysticbinary  阅读(41)  评论(0编辑  收藏  举报