I am trying to copy a file named Podfile
from the project’s root directory to the output directory with the following code:
message("Copy ${CMAKE_CURRENT_SOURCE_DIR}/Podfile -> ${CMAKE_BINARY_DIR}")
add_custom_target(copy_podfile
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_CURRENT_SOURCE_DIR}/Podfile"
"${CMAKE_BINARY_DIR}"
COMMENT "Copying Podfile"
)
add_dependencies(${PROJECT_NAME} copy_podfile)
, but without a success.
It shows the message
Copy /Users/admin/dev/repos/AdExample/Podfile -> /Users/admin/dev/repos/AdExample/build/Qt_6_7_0_iOS_Release_Simulator
but does not copy Podfile
.
What did I miss?
cmake version: 3.29.2.
See the full source code on GitHub.
5
It was a wrong question, the file is copied at the build stage, but not when I run CMake:
The following command copies Podfile
at the configuration stage:
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_CURRENT_SOURCE_DIR}/Podfile"
"${CMAKE_BINARY_DIR}"
)