Skip to content

Commit

Permalink
Add esma_add_fortran_submodules (v3)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathomp4 committed Jun 20, 2024
1 parent 14d47db commit fc73362
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Deprecated

## [3.46.0] - 2024-06-21

### Added

- Add the file `esma_add_fortran_submodules.cmake` in the `esma_support` folder. The file contains a function that prevents conflicts when several submodule files have the same name.

## [3.45.3] - 2024-06-14

### Fixed
Expand Down
27 changes: 27 additions & 0 deletions esma_support/esma_add_fortran_submodules.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Function to avoid conflicts with files (in separate folders) with the same name.
# The function is necessary for submodule files.

function(esma_add_fortran_submodules)
set(options)
set(oneValueArgs TARGET SUBDIRECTORY)
set(multiValueArgs SOURCES)
cmake_parse_arguments(
ARG "${options}" "${oneValueArgs}"
"${multiValueArgs}" ${ARGN}
)

foreach(file ${ARG_SOURCES})

set(input ${CMAKE_CURRENT_SOURCE_DIR}/${ARG_SUBDIRECTORY}/${file})
set(output ${CMAKE_CURRENT_BINARY_DIR}/${ARG_SUBDIRECTORY}_${file})
add_custom_command(
OUTPUT ${output}
COMMAND ${CMAKE_COMMAND} -E copy ${input} ${output}
DEPENDS ${input}
)
set_property(SOURCE ${output} PROPERTY GENERATED 1)
target_sources(${ARG_TARGET} PRIVATE ${output})

endforeach()

endfunction()
1 change: 1 addition & 0 deletions esma_support/esma_support.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ include (esma_add_library)
include (esma_generate_automatic_code)
include (esma_create_stub_component)
include (esma_fortran_generator_list)
include (esma_add_fortran_submodules)

# Testing
include (esma_enable_tests)

0 comments on commit fc73362

Please sign in to comment.