Skip to content

Commit

Permalink
cmake: Add missing keyword for TARGET form of add_custom_command.
Browse files Browse the repository at this point in the history
The `TARGET` form of `add_custom_command` requires a keyword that defines
the target build order. Newer versions of CMake (version 3.31 or later)
warn if that keyword is missing. See:
https://cmake.org/cmake/help/latest/policy/CMP0175.html#policy:CMP0175

Add the keyword `POST_BUILD` that prior versions of CMake assumed by
default.
  • Loading branch information
mmuetzel committed Jan 12, 2025
1 parent 18505d2 commit 729763f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions elmerice/Tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,13 @@ ADD_CUSTOM_TARGET(ElmerIceTests_package
FOREACH(_file ${ELMERICE_TEST_FILES})
IF(NOT(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${_file}))
ADD_CUSTOM_COMMAND(TARGET ElmerIceTests
POST_BUILD
COMMAND "${CMAKE_COMMAND}" "-E" "copy"
"${CMAKE_CURRENT_SOURCE_DIR}/${_file}"
"${CMAKE_BINARY_DIR}/elmerice-tests/${_file}")
ELSE()
ADD_CUSTOM_COMMAND(TARGET ElmerIceTests
POST_BUILD
COMMAND "${CMAKE_COMMAND}" "-E" "copy_directory"
"${CMAKE_CURRENT_SOURCE_DIR}/${_file}"
"${CMAKE_BINARY_DIR}/elmerice-tests/${_file}")
Expand Down
2 changes: 2 additions & 0 deletions fem/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,13 @@ ADD_CUSTOM_TARGET(ElmerTests_package
FOREACH(_file ${ELMER_TEST_FILES})
IF(NOT(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${_file}))
ADD_CUSTOM_COMMAND(TARGET ElmerTests
POST_BUILD
COMMAND "${CMAKE_COMMAND}" "-E" "copy"
"${CMAKE_CURRENT_SOURCE_DIR}/${_file}"
"${CMAKE_BINARY_DIR}/elmerfem-tests/${_file}")
ELSE()
ADD_CUSTOM_COMMAND(TARGET ElmerTests
POST_BUILD
COMMAND "${CMAKE_COMMAND}" "-E" "copy_directory"
"${CMAKE_CURRENT_SOURCE_DIR}/${_file}"
"${CMAKE_BINARY_DIR}/elmerfem-tests/${_file}")
Expand Down

0 comments on commit 729763f

Please sign in to comment.