Files
SOEM/cmake/AddENI.cmake
Hans-Erik Floryd bd9f7b86c4 Update headers
Fix some headers that were missed in previous commits.

Change-Id: Ifa08fedf9199ba8c8a0766293bc7933e7f7475f2
2025-07-11 14:13:56 +02:00

40 lines
1.0 KiB
CMake

# This software is dual-licensed under GPLv3 and a commercial
# license. See the file LICENSE.md distributed with this software for
# full license information.
#[=======================================================================[.rst:
add_eni
--------
Helper function to run eniconv on ENI file.
.. command:: add_eni
.. code-block:: cmake
add_eni(<target> <enifile>)
Runs eniconv on ``enifile`` and adds the output file to the list of
sources for ``<target>``.
#]=======================================================================]
find_package(Python3 REQUIRED)
find_program(ENICONV eniconv.py PATH_SUFFIXES scripts PATHS ${SOEM_SOURCE_DIR} REQUIRED)
function(add_eni target eni)
cmake_path(GET eni STEM _eni_name)
cmake_path(ABSOLUTE_PATH eni OUTPUT_VARIABLE _eni)
add_custom_command (
OUTPUT ${_eni_name}.c
DEPENDS ${_eni}
COMMAND ${Python3_EXECUTABLE} ${ENICONV} ${_eni} > ${_eni_name}.c
VERBATIM
)
target_sources(${target}
PRIVATE
${_eni_name}.c
)
endfunction()