[flang-commits] [flang] c4cb2c0 - [Flang] Multi-config CMake output paths in standalone builds (#208690)
via flang-commits
flang-commits at lists.llvm.org
Mon Jul 13 07:29:39 PDT 2026
Author: Michael Kruse
Date: 2026-07-13T16:29:34+02:00
New Revision: c4cb2c0e763c304071e950e47dd0c25a7dcfbbca
URL: https://github.com/llvm/llvm-project/commit/c4cb2c0e763c304071e950e47dd0c25a7dcfbbca
DIFF: https://github.com/llvm/llvm-project/commit/c4cb2c0e763c304071e950e47dd0c25a7dcfbbca.diff
LOG: [Flang] Multi-config CMake output paths in standalone builds (#208690)
When using a multi-config generator with CMake (such as "Ninja
Multi-Config" or any Visual Studio generator), the output path must be
specific to each config by having it include `${CMAKE_CFG_INTDIR}`.
`CMAKE_CFG_INTDIR` will just be `.` in single-config generators. Use the
same path as used by LLVM:
https://github.com/llvm/llvm-project/blob/cd662a7c4fb03a88d0e429a7fc8d8b470a812e2b/llvm/CMakeLists.txt#L562-L563
`LLVM_LIBDIR_SUFFIX` was seemingly forgotten in one of the paths.
This is not complete support (neither has LLVM). More paths would need
to be config-specific. In particular, `check-flang` does not work, but
at least one can build the executables.
Added:
Modified:
flang/CMakeLists.txt
Removed:
################################################################################
diff --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt
index bd3ce6d6b6ff5..0c5a690f8712f 100644
--- a/flang/CMakeLists.txt
+++ b/flang/CMakeLists.txt
@@ -210,11 +210,11 @@ if (FLANG_STANDALONE_BUILD)
link_directories("${LLVM_LIBRARY_DIR}")
- set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
+ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY
- ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
+ ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY
- ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
+ ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
set(LIT_ARGS_DEFAULT "-sv")
if (MSVC OR XCODE)
@@ -294,8 +294,8 @@ include_directories(SYSTEM ${CLANG_INCLUDE_DIR})
# tco tool and FIR lib output directories
if(FLANG_STANDALONE_BUILD)
- set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/bin)
- set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/lib)
+ set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
+ set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
endif()
# Always build tco tool
set(LLVM_BUILD_TOOLS ON)
More information about the flang-commits
mailing list