Use CMake 3.23 FILE_SET install rules
This commit is contained in:
parent
40b57c71fc
commit
d451541b41
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue