From 4bd9422bf7d0c817ae20cb5f61da74ea52e41551 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sat, 21 Dec 2019 14:38:21 +0300 Subject: utils: install() PDB files --- utils/CMakeLists.txt | 43 +++++++++++++++++-------------------------- 1 file changed, 17 insertions(+), 26 deletions(-) (limited to 'utils') diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 1aa22d8..27d3422 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -1,36 +1,27 @@ find_package(Boost REQUIRED COMPONENTS filesystem program_options) -set(block_util_headers block_cmd_parser.hpp block_dumper.hpp block_input.hpp data_parsers.hpp helpers/command_line.hpp) +function(add_util name src) + set(target "util_${name}") + add_executable("${target}" ${src}) + target_link_libraries("${target}" PRIVATE aesxx Boost::filesystem Boost::program_options) + set_target_properties("${target}" PROPERTIES OUTPUT_NAME "${name}") + install(TARGETS "${target}" RUNTIME DESTINATION bin) + if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + install(FILES "$" DESTINATION bin OPTIONAL) + endif() +endfunction() -add_executable(util_encrypt_block encrypt_block.cpp ${block_util_headers}) -target_link_libraries(util_encrypt_block PRIVATE aesxx Boost::filesystem Boost::program_options) -set_target_properties(util_encrypt_block PROPERTIES OUTPUT_NAME encrypt_block) +set(block_util_headers block_cmd_parser.hpp block_dumper.hpp block_input.hpp data_parsers.hpp helpers/command_line.hpp) -add_executable(util_decrypt_block decrypt_block.cpp ${block_util_headers}) -target_link_libraries(util_decrypt_block PRIVATE aesxx Boost::filesystem Boost::program_options) -set_target_properties(util_decrypt_block PROPERTIES OUTPUT_NAME decrypt_block) +add_util(encrypt_block encrypt_block.cpp ${block_util_headers}) +add_util(decrypt_block decrypt_block.cpp ${block_util_headers}) set(file_util_headers data_parsers.hpp file_cmd_parser.hpp helpers/command_line.hpp helpers/file.hpp) -add_executable(util_encrypt_file encrypt_file.cpp ${file_util_headers}) -target_link_libraries(util_encrypt_file PRIVATE aesxx Boost::filesystem Boost::program_options) -set_target_properties(util_encrypt_file PROPERTIES OUTPUT_NAME encrypt_file) - -add_executable(util_decrypt_file decrypt_file.cpp ${file_util_headers}) -target_link_libraries(util_decrypt_file PRIVATE aesxx Boost::filesystem Boost::program_options) -set_target_properties(util_decrypt_file PROPERTIES OUTPUT_NAME decrypt_file) +add_util(encrypt_file encrypt_file.cpp ${file_util_headers}) +add_util(decrypt_file decrypt_file.cpp ${file_util_headers}) set(bmp_util_headers ${file_util_headers} helpers/bmp.hpp) -add_executable(util_encrypt_bmp encrypt_bmp.cpp ${bmp_util_headers}) -target_link_libraries(util_encrypt_bmp PRIVATE aesxx Boost::filesystem Boost::program_options) -set_target_properties(util_encrypt_bmp PROPERTIES OUTPUT_NAME encrypt_bmp) - -add_executable(util_decrypt_bmp decrypt_bmp.cpp ${bmp_util_headers}) -target_link_libraries(util_decrypt_bmp PRIVATE aesxx Boost::filesystem Boost::program_options) -set_target_properties(util_decrypt_bmp PROPERTIES OUTPUT_NAME decrypt_bmp) - -install(TARGETS - util_encrypt_block util_encrypt_file util_encrypt_bmp - util_decrypt_block util_decrypt_file util_decrypt_bmp - RUNTIME DESTINATION bin) +add_util(encrypt_bmp encrypt_bmp.cpp ${bmp_util_headers}) +add_util(decrypt_bmp decrypt_bmp.cpp ${bmp_util_headers}) -- cgit v1.2.3