From f344d7ec61679fa6912fbf846408b9f4097158a6 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Tue, 18 Apr 2017 20:59:33 +0000 Subject: [PATCH] Make Ninja generator happy with BUILD_BYPRODUCTS. --- extra/mariabackup/CMakeLists.txt | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/extra/mariabackup/CMakeLists.txt b/extra/mariabackup/CMakeLists.txt index f3369b49cee..6f5a17d3614 100644 --- a/extra/mariabackup/CMakeLists.txt +++ b/extra/mariabackup/CMakeLists.txt @@ -56,6 +56,7 @@ IF((NOT WITH_LIBARCHIVE STREQUAL "OFF") AND (NOT LibArchive_FOUND)) ELSE() # Build a local version INCLUDE(ExternalProject) + SET(LIBARCHIVE_DIR ${CMAKE_CURRENT_BINARY_DIR}/libarchive) SET(libarchive_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/libarchive) SET(libarchive_CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= @@ -71,27 +72,35 @@ IF((NOT WITH_LIBARCHIVE STREQUAL "OFF") AND (NOT LibArchive_FOUND)) ) IF(WIN32) SET(libarchive_CMAKE_ARGS ${libarchive_CMAKE_ARGS} -DWINDOWS_VERSION=WIN7 -DCMAKE_DEBUG_POSTFIX=d) + SET(LIBARCHIVE_RELEASE_LIB ${LIBARCHIVE_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}archive_static${CMAKE_STATIC_LIBRARY_SUFFIX}) + SET(LIBARCHIVE_DEBUG_LIB ${LIBARCHIVE_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}archive_staticd${CMAKE_STATIC_LIBRARY_SUFFIX}) + SET(byproducts ${LIBARCHIVE_RELEASE_LIB} ${LIBARCHIVE_DEBUG_LIB}) + ELSE() + SET(LIBARCHIVE_LIB ${LIBARCHIVE_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}archive${CMAKE_STATIC_LIBRARY_SUFFIX}) + SET(byproducts ${LIBARCHIVE_LIB}) + ENDIF() + + IF(CMAKE_VERSION VERSION_GREATER "3.1") + SET(byproducts BUILD_BYPRODUCTS ${byproducts}) ENDIF() - SET(LIBARCHIVE_DIR ${CMAKE_CURRENT_BINARY_DIR}/libarchive) ExternalProject_Add(libarchive PREFIX ${libarchive_PREFIX} DOWNLOAD_DIR ${LIBARCHIVE_DIR} URL http://www.libarchive.org/downloads/libarchive-3.2.2.tar.gz INSTALL_DIR ${LIBARCHIVE_DIR} CMAKE_ARGS ${libarchive_CMAKE_ARGS} + ${byproducts} ) ADD_LIBRARY(archive_static STATIC IMPORTED) ADD_DEPENDENCIES(archive_static libarchive) IF(WIN32) - SET(LIBARCHIVE_RELEASE_LIB ${LIBARCHIVE_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}archive_static${CMAKE_STATIC_LIBRARY_SUFFIX}) - SET(LIBARCHIVE_DEBUG_LIB ${LIBARCHIVE_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}archive_staticd${CMAKE_STATIC_LIBRARY_SUFFIX}) SET_PROPERTY(TARGET archive_static PROPERTY IMPORTED_LOCATION_RELWITHDEBINFO ${LIBARCHIVE_RELEASE_LIB}) SET_PROPERTY(TARGET archive_static PROPERTY IMPORTED_LOCATION_RELEASE ${LIBARCHIVE_RELEASE_LIB}) SET_PROPERTY(TARGET archive_static PROPERTY IMPORTED_LOCATION_DEBUG ${LIBARCHIVE_DEBUG_LIB}) SET_PROPERTY(TARGET archive_static PROPERTY IMPORTED_LOCATION_MINSIZEREL ${LIBARCHIVE_RELEASE_LIB}) ELSE() - SET_PROPERTY(TARGET archive_static PROPERTY IMPORTED_LOCATION ${LIBARCHIVE_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}archive${CMAKE_STATIC_LIBRARY_SUFFIX}) + SET_PROPERTY(TARGET archive_static PROPERTY IMPORTED_LOCATION ${LIBARCHIVE_LIB}) ENDIF() SET(LibArchive_FOUND ON )