diff --git a/CMakeLists.txt b/CMakeLists.txt index 752ee7a..becc373 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.23) set(CMAKE_C_STANDARD 99) @@ -10,20 +10,20 @@ project(hmac_sha256 LANGUAGES C CXX) option(HMAC_SHA256_TESTS "Build unit tests" FALSE) option(HMAC_SHA256_EXAMPLES "Build the examples" FALSE) -add_library(hmac_sha256 STATIC +add_library(hmac_sha256 STATIC) +target_sources(hmac_sha256 + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/sha256.c ${CMAKE_CURRENT_SOURCE_DIR}/hmac_sha256.c + PUBLIC FILE_SET HEADERS FILES + ${CMAKE_CURRENT_SOURCE_DIR}/sha256.h + ${CMAKE_CURRENT_SOURCE_DIR}/hmac_sha256.h ) -target_include_directories(hmac_sha256 INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) install(TARGETS hmac_sha256 - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" - ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" -) - -install(FILES - ${CMAKE_CURRENT_SOURCE_DIR}/hmac_sha256.h - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + FILE_SET HEADERS DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" ) if (HMAC_SHA256_TESTS)