Skip to content

Commit

Permalink
Improvements to the CopyGenerated script.
Browse files Browse the repository at this point in the history
  • Loading branch information
arobenko committed Feb 27, 2024
1 parent 1a9f287 commit 1af2873
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ if ((NOT CC_X509_ASN1_SCHEMA) OR (NOT CC_X509_ASN1_EMB_SCHEMA))
message (FATAL_ERROR "The required ASN.1 definition schema is not found.")
endif ()

message (STATUS "Found ASN.1 schema files: ${CC_X509_ASN1_SCHEMA};${CC_X509_ASN1_EMB_SCHEMA}")

get_filename_component(asn1_dir ${CC_X509_ASN1_SCHEMA} DIRECTORY)
set (CC_X509_ASN1_DSL_SRC ${asn1_dir}/../dsl_src)

Expand Down
25 changes: 11 additions & 14 deletions cmake/CopyGenerated.cmake
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
# GENERATED
# OUTPUT
# CLEANUP_DIRS

function (copyIfDifferent generated output)
if (("${generated}" STREQUAL "") OR ("${output}" STREQUAL ""))
message (FATAL_ERROR "Bad directory name(s)")
endif ()

file(GLOB_RECURSE genFiles RELATIVE "${generated}/" "${generated}/*")
foreach( f ${genFiles} )
set(dest "${output}/${f}")
set(src "${generated}/${f}")
#message (STATUS "Copying ${src} -> ${dest}")
execute_process(
COMMAND ${CMAKE_COMMAND}
-E copy_if_different ${src} ${dest})
set(dest "${output}/${f}")
set(src "${generated}/${f}")
#message (STATUS "Copying ${src} -> ${dest}")
execute_process(
COMMAND ${CMAKE_COMMAND}
-E copy_if_different ${src} ${dest})
endforeach()
endfunction ()

Expand All @@ -31,8 +26,10 @@ function (deleteRemoved generated output)
endforeach()
endfunction ()

if (("${GENERATED}" STREQUAL "") OR ("${OUTPUT}" STREQUAL ""))
message (FATAL_ERROR "Bad directory name(s)")
endif ()

message (STATUS "Copying: ${GENERATED} --> ${OUTPUT}")
copyIfDifferent ("${GENERATED}" "${OUTPUT}")
foreach (d ${CLEANUP_DIRS})
deleteRemoved ("${GENERATED}/${d}" "${OUTPUT}/${d}")
endforeach()
deleteRemoved ("${GENERATED}" "${OUTPUT}")

0 comments on commit 1af2873

Please sign in to comment.