From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 7309E6EFDA; Thu, 2 Jun 2022 16:23:13 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 7309E6EFDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1654176193; bh=GxrrE/PjmfOpXxzes07QHXHrun0jkXl8pv9NVOf0mWk=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=xjARDyxXGzXl8luHqVQoLSUcl0OpLDiTXoOHHeSw4tgfZcVKhUHVFy9LLIDU5Ftq1 2o6PEalppWkVetXqynA1E4vLvAheAL9luwhWEwq1wm8FMMHdsS/IiJbiOwjqcDul9n vGDW9+Knw1zJ+rxn7/KL2Vv9qvCDkR/tGMw2kVlQ= Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 2925C6EFDA for ; Thu, 2 Jun 2022 16:22:36 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 2925C6EFDA Received: by mail-lj1-f175.google.com with SMTP id t13so5231621ljd.6 for ; Thu, 02 Jun 2022 06:22:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cd8yL0tgKJ7HJZxct4Ia+Iq/EQbRH81ZDBHJofQ1ho8=; b=K7MPq05kCjk4LgKRj+ZfAoFZyP1lzajUOmQLKZ0jHGa9nX87lu6Xe8C8yorP+20j5z oOOmlVYfQ+qzX4TUpYdAGNAG36ttE29QUKOMFYQ2jltI3a6DRCPL0Os0aRrGbpVkKDeF bZjuW1eKbBhOOClrPOyziFPb3DkmubhFizm9mX2cnnhg9aJLobmSOrSldpkMqkZyGYlH qGRNc0oRCasT4ch2pPzSfXYD2FDAq286G0l2mxnKMsv3UM2UVc5zEnj5Kpc6xBvWD1CD aivnYW4fpIx0pNcsqHm3eGDtYWgY/n1q4dDIY4xVXTjO2oPuCliouUB+jB0dDPNY2Ixk Py0A== X-Gm-Message-State: AOAM532rGmtADfEcPf6/kagcC8KDn9B8PLIdPqOijnfYapDEgWfSTBiC a6LyKyyrpxRDITmRLfWQzrcb3BjkNbw= X-Google-Smtp-Source: ABdhPJwjKWpIl9gh5ptdbT95eT3qa1FYn7LaVgapwOTHLtLwrEE1H4L6vF9fNAYHJQz8fbHjBD6YFQ== X-Received: by 2002:a2e:a367:0:b0:253:f4fd:4936 with SMTP id i7-20020a2ea367000000b00253f4fd4936mr28593854ljn.5.1654176155544; Thu, 02 Jun 2022 06:22:35 -0700 (PDT) Received: from pony.mail.msk ([2a00:1148:b0ba:16:2894:da3a:9c3f:b06]) by smtp.gmail.com with ESMTPSA id q11-20020a05651232ab00b00477b6328a4fsm1025223lfe.158.2022.06.02.06.22.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jun 2022 06:22:34 -0700 (PDT) X-Google-Original-From: Sergey Bronnikov To: tarantool-patches@dev.tarantool.org Date: Thu, 2 Jun 2022 16:22:31 +0300 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [v2][PATCH 2/5] build/ninja: create target with cli binary only once X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Sergey Bronnikov via Tarantool-patches Reply-To: Sergey Bronnikov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" CMakeLists defines target for cli binary two times (for static and shared build type) with the same output names. CMake generates two targets with same names and it breaks Ninja: ninja: Entering directory `build/' ninja: error: build.ninja:1656: multiple rules generate src/luajit [-w dupbuild=err] Patch adds variables required for different build types and create target for cli binary only once to avoid conflict. --- src/CMakeLists.txt | 40 ++++++++++++++++------------------------ 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8b651c5a..104ce999 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -313,40 +313,32 @@ target_link_libraries(libluajit_shared ${TARGET_LIBS}) # Compiling and linking CLIs. -add_executable(luajit_static EXCLUDE_FROM_ALL ${CLI_SOURCES}) -set_target_properties(luajit_static PROPERTIES - OUTPUT_NAME "${LUAJIT_CLI_NAME}" - COMPILE_FLAGS "${TARGET_C_FLAGS}" - LINK_FLAGS "${TARGET_BIN_FLAGS}" - RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" -) -target_include_directories(luajit_static PRIVATE - ${CMAKE_CURRENT_BINARY_DIR} -) -target_link_libraries(luajit_static libluajit_static ${TARGET_LIBS}) - -add_executable(luajit_shared EXCLUDE_FROM_ALL ${CLI_SOURCES}) -set_target_properties(luajit_shared PROPERTIES - OUTPUT_NAME "${LUAJIT_CLI_NAME}" - COMPILE_FLAGS "${TARGET_C_FLAGS}" - LINK_FLAGS "${TARGET_BIN_FLAGS}" - RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" -) -target_include_directories(luajit_shared PRIVATE - ${CMAKE_CURRENT_BINARY_DIR} -) -target_link_libraries(luajit_shared libluajit_shared ${TARGET_LIBS}) - if(NOT BUILDMODE STREQUAL "dynamic") set(LIBLUAJIT_STATIC_DEPS libluajit_static) set(LUAJIT_DEPS luajit_static) + set(LUAJIT_BIN luajit_static) + set(LUAJIT_LIB libluajit_static) endif() if(NOT BUILDMODE STREQUAL "static") set(LIBLUAJIT_SHARED_DEPS libluajit_shared) set(LUAJIT_DEPS luajit_shared) + set(LUAJIT_BIN luajit_shared) + set(LUAJIT_LIB libluajit_shared) endif() set(LIBLUAJIT_DEPS ${LIBLUAJIT_STATIC_DEPS} ${LIBLUAJIT_SHARED_DEPS}) +add_executable(${LUAJIT_BIN} EXCLUDE_FROM_ALL ${CLI_SOURCES}) +set_target_properties(luajit_shared PROPERTIES + OUTPUT_NAME "${LUAJIT_CLI_NAME}" + COMPILE_FLAGS "${TARGET_C_FLAGS}" + LINK_FLAGS "${TARGET_BIN_FLAGS}" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" +) +target_include_directories(${LUAJIT_BIN} PRIVATE + ${CMAKE_CURRENT_BINARY_DIR} +) +target_link_libraries(${LUAJIT_BIN} ${LUAJIT_LIB} ${TARGET_LIBS}) + # XXX: The variable is used in testing, so PARENT_SCOPE option # is obligatory. set(LUAJIT_BINARY $ PARENT_SCOPE) -- 2.25.1