Skip to content

Commit

Permalink
fix:build:cmake:fix in-tree cmake build circular dependency warnings (#…
Browse files Browse the repository at this point in the history
…1122)

Only copy files when SOURCE and DESTINATION directory differs.
No need to copy files into themselves when doing in-tree build.

Removes annoying warning.

```
make[2]: Circular navit/textures/diagonal-stripes.svg <- navit/textures/diagonal-stripes.svg dependency dropped.
```

Signed-off-by: David Heidelberg <david@ixit.cz>
  • Loading branch information
okias committed May 23, 2021
1 parent 3046130 commit 03b7ce2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions navit/icons/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ foreach (IMAGE_SRC ${FILES_TO_PNG})

endforeach()

if (NOT ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR} )
foreach (IMAGE_FILE ${IMAGES_TO_COPY})
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${IMAGE_FILE}"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${IMAGE_FILE}"
Expand All @@ -135,6 +136,7 @@ foreach (IMAGE_FILE ${IMAGES_TO_COPY})
)
list(APPEND IMAGE_TARGETS "${CMAKE_CURRENT_BINARY_DIR}/${IMAGE_FILE}")
endforeach()
endif()

add_custom_target(images ALL DEPENDS ${IMAGE_TARGETS})
add_custom_target(images_resource COMMAND mkdir -p ../resources/share/navit/xpm COMMAND cp ${IMAGE_TARGETS} ../resources/share/navit/xpm)
Expand Down
2 changes: 2 additions & 0 deletions navit/textures/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ foreach (TEXTURE_SRC ${FILES_TO_PNG})

endforeach()

if (NOT ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR} )
foreach (TEXTURE_FILE ${TEXTURES_TO_COPY})
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${TEXTURE_FILE}"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${TEXTURE_FILE}"
Expand All @@ -118,6 +119,7 @@ foreach (TEXTURE_FILE ${TEXTURES_TO_COPY})
)
list(APPEND TEXTURE_TARGETS "${CMAKE_CURRENT_BINARY_DIR}/${TEXTURE_FILE}")
endforeach()
endif()

add_custom_target(textures ALL DEPENDS ${TEXTURE_TARGETS})
add_custom_target(textures_resource COMMAND mkdir -p ../resources/share/navit/textures COMMAND cp ${TEXTURE_TARGETS} ../resources/share/navit/textures)
Expand Down

0 comments on commit 03b7ce2

Please sign in to comment.