diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 167c31d..dacd7e7 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,5 +1,5 @@ ############################################################################## -# Copyright (c) 2021, 2022 Leon Lynch +# Copyright (c) 2021-2023 Leon Lynch # # This file is licensed under the terms of the LGPL v2.1 license. # See LICENSE file. @@ -8,31 +8,16 @@ cmake_minimum_required(VERSION 3.16) if (BUILD_TESTING) - add_executable(emv_ttl_tpdu_test emv_ttl_tpdu_test.c ../tools/print_helpers.c) - target_link_libraries(emv_ttl_tpdu_test - PRIVATE - emv_strings # For print_helpers - emv - iso7816 # For print_helpers - ) + add_executable(emv_ttl_tpdu_test emv_ttl_tpdu_test.c) + target_link_libraries(emv_ttl_tpdu_test PRIVATE print_helpers emv) add_test(emv_ttl_tpdu_test emv_ttl_tpdu_test) - add_executable(emv_ttl_pcsc_test emv_ttl_pcsc_test.c ../tools/print_helpers.c) - target_link_libraries(emv_ttl_pcsc_test - PRIVATE - emv_strings # For print_helpers - emv - iso7816 # For print_helpers - ) + add_executable(emv_ttl_pcsc_test emv_ttl_pcsc_test.c) + target_link_libraries(emv_ttl_pcsc_test PRIVATE print_helpers emv) add_test(emv_ttl_pcsc_test emv_ttl_pcsc_test) - add_executable(emv_str_parse_test emv_str_parse_test.c ../tools/print_helpers.c) - target_link_libraries(emv_str_parse_test - PRIVATE - emv_strings # For print_helpers - emv - iso7816 # For print_helpers - ) + add_executable(emv_str_parse_test emv_str_parse_test.c) + target_link_libraries(emv_str_parse_test PRIVATE print_helpers emv_strings) add_test(emv_str_parse_test emv_str_parse_test) add_executable(emv_aid_info_test emv_aid_info_test.c) diff --git a/tests/emv_str_parse_test.c b/tests/emv_str_parse_test.c index ff5bc6a..2e2b628 100644 --- a/tests/emv_str_parse_test.c +++ b/tests/emv_str_parse_test.c @@ -25,7 +25,7 @@ #include // For debug output -#include "../tools/print_helpers.h" +#include "print_helpers.h" int main(void) { diff --git a/tests/emv_ttl_pcsc_test.c b/tests/emv_ttl_pcsc_test.c index 763bade..4b326c4 100644 --- a/tests/emv_ttl_pcsc_test.c +++ b/tests/emv_ttl_pcsc_test.c @@ -26,7 +26,7 @@ #include // For debug output -#include "../tools/print_helpers.h" +#include "print_helpers.h" struct apdu_t { size_t c_apdu_len; diff --git a/tests/emv_ttl_tpdu_test.c b/tests/emv_ttl_tpdu_test.c index 87eef60..fac0b7d 100644 --- a/tests/emv_ttl_tpdu_test.c +++ b/tests/emv_ttl_tpdu_test.c @@ -27,7 +27,7 @@ #include // For debug output -#include "../tools/print_helpers.h" +#include "print_helpers.h" struct tpdu_t { size_t c_tpdu_len; diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 80d3edc..d89fe09 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -1,5 +1,5 @@ ############################################################################## -# Copyright (c) 2022 Leon Lynch +# Copyright (c) 2022-2023 Leon Lynch # # This file is licensed under the terms of the LGPL v2.1 license. # See LICENSE file. @@ -47,14 +47,21 @@ endif() include(GNUInstallDirs) # Provides CMAKE_INSTALL_* variables and good defaults for install() +# Print helpers object library +add_library(print_helpers OBJECT EXCLUDE_FROM_ALL print_helpers.c) +target_include_directories(print_helpers INTERFACE + $ +) +target_link_libraries(print_helpers PRIVATE iso7816 emv emv_strings) + # EMV decode command line tool if(BUILD_EMV_DECODE) - add_executable(emv-decode emv-decode.c print_helpers.c) + add_executable(emv-decode emv-decode.c) set_source_files_properties(emv-decode.c PROPERTIES COMPILE_DEFINITIONS EMV_UTILS_VERSION_STRING="${EMV_UTILS_VERSION_STRING}" ) - target_link_libraries(emv-decode PRIVATE emv_strings emv iso7816 iso8859) + target_link_libraries(emv-decode PRIVATE print_helpers iso7816 emv emv_strings iso8859) if(TARGET libargp::argp) target_link_libraries(emv-decode PRIVATE libargp::argp) endif() @@ -77,12 +84,12 @@ if(BUILD_EMV_TOOL) ) endif() - add_executable(emv-tool emv-tool.c print_helpers.c ../src/pcsc.c) + add_executable(emv-tool emv-tool.c ../src/pcsc.c) set_source_files_properties(emv-tool.c PROPERTIES COMPILE_DEFINITIONS EMV_UTILS_VERSION_STRING="${EMV_UTILS_VERSION_STRING}" ) - target_link_libraries(emv-tool PRIVATE emv_strings emv iso7816) + target_link_libraries(emv-tool PRIVATE print_helpers iso7816 emv emv_strings) if(TARGET libargp::argp) target_link_libraries(emv-tool PRIVATE libargp::argp) endif() diff --git a/tools/print_helpers.c b/tools/print_helpers.c index b82b6ae..dee6471 100644 --- a/tools/print_helpers.c +++ b/tools/print_helpers.c @@ -30,8 +30,8 @@ #include "emv_tlv.h" #include "emv_dol.h" #include "emv_app.h" -#include "emv_strings.h" #include "emv_debug.h" +#include "emv_strings.h" #include #include