From 597c48830252dc70f7ae8dd6830d3afde5529629 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Smoczy=C5=84ski?= Date: Tue, 26 Jan 2021 01:42:11 +0100 Subject: [PATCH] [EGD-5396] Fix project building with Ninja MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix ninja build by conditionally removing custom targets for ecoboot.bin and version.json. Ninja works well without them anyway as opposed to Unix Makefile which needs them to be able to use direct file rules. References: - https://cmake.org/Bug/view.php?id=15614 - https://gitlab.kitware.com/cmake/cmake/-/issues/18627 Signed-off-by: Marcin SmoczyƄski --- CMakeLists.txt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b59f250a09142074c30ea279e6b7293194c4a8e3..8e8a9fdf55c51860b8c03498de175ffdca6aef35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -280,7 +280,7 @@ if (${PROJECT_TARGET} STREQUAL "TARGET_RT1051") -w ${CMAKE_BINARY_DIR} ecoboot download > ${ECOBOOT_DOWNLOAD_LOG} COMMENT "Downloading ecoboot.bin" - BYPRODUCTS ${ECOBOOT_FILE} ${ECOBOOT_DOWNLOAD_LOG} + BYPRODUCTS ${ECOBOOT_DOWNLOAD_LOG} ) else() message("ecoboot download with git") @@ -289,11 +289,13 @@ if (${PROJECT_TARGET} STREQUAL "TARGET_RT1051") -w ${CMAKE_BINARY_DIR} ecoboot download > ${ECOBOOT_DOWNLOAD_LOG} COMMENT "Downloading ecoboot.bin" - BYPRODUCTS ${ECOBOOT_FILE} ${ECOBOOT_DOWNLOAD_LOG} + BYPRODUCTS ${ECOBOOT_DOWNLOAD_LOG} ) endif() - add_custom_target(ecoboot.bin DEPENDS ${ECOBOOT_FILE}) + if(NOT ${CMAKE_GENERATOR} STREQUAL "Ninja") + add_custom_target(ecoboot.bin DEPENDS ${ECOBOOT_FILE}) + endif() # generate version.json file (runs CMake script at build time) set(VERSION_JSON ${CMAKE_BINARY_DIR}/version.json) @@ -304,9 +306,11 @@ if (${PROJECT_TARGET} STREQUAL "TARGET_RT1051") -B ${CMAKE_BINARY_DIR} -P ${CMAKE_SOURCE_DIR}/config/GenUpdateVersionJson.cmake DEPENDS ecoboot.bin ${ECOBOOT_DOWNLOAD_LOG} - BYPRODUCTS ${VERSION_JSON} ) - add_custom_target(version.json DEPENDS ${VERSION_JSON}) + + if(NOT ${CMAKE_GENERATOR} STREQUAL "Ninja") + add_custom_target(version.json DEPENDS ${VERSION_JSON}) + endif() multicomp_install(PROGRAMS ${ECOBOOT_FILE} DESTINATION "./" COMPONENTS Standalone Update) multicomp_install(FILES ${VERSION_JSON} DESTINATION "./" COMPONENTS Standalone Update)