[flang-commits] [flang] 6d0d411 - [flang] Fixed out-of-tree build after D156435.

Slava Zakharin via flang-commits flang-commits at lists.llvm.org
Tue Aug 1 10:52:28 PDT 2023


Author: Slava Zakharin
Date: 2023-08-01T10:52:04-07:00
New Revision: 6d0d4113dfb94ae83a99d7bdf51f7c619f5eca15

URL: https://github.com/llvm/llvm-project/commit/6d0d4113dfb94ae83a99d7bdf51f7c619f5eca15
DIFF: https://github.com/llvm/llvm-project/commit/6d0d4113dfb94ae83a99d7bdf51f7c619f5eca15.diff

LOG: [flang] Fixed out-of-tree build after D156435.

I decided to clean up the CMake files as well.
Only FotranEvaluate directly needs quadmath, so we only need
to link these two together.

Differential Revision: https://reviews.llvm.org/D156808

Added: 
    

Modified: 
    flang/lib/Evaluate/CMakeLists.txt
    flang/lib/Frontend/CMakeLists.txt
    flang/tools/bbc/CMakeLists.txt
    flang/unittests/Evaluate/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/flang/lib/Evaluate/CMakeLists.txt b/flang/lib/Evaluate/CMakeLists.txt
index e75aabafc323fd..b38f450d746ea7 100644
--- a/flang/lib/Evaluate/CMakeLists.txt
+++ b/flang/lib/Evaluate/CMakeLists.txt
@@ -1,3 +1,5 @@
+include(CheckLibraryExists)
+
 if (LIBPGMATH_DIR)
   # If pgmath library is found, it can be used for constant folding.
   find_library(LIBPGMATH pgmath PATHS ${LIBPGMATH_DIR})
@@ -23,6 +25,7 @@ check_include_file(quadmath.h FOUND_QUADMATH_HEADER)
 check_library_exists(quadmath sinq "" FOUND_QUADMATH_LIB)
 if(FOUND_QUADMATH_HEADER AND FOUND_QUADMATH_LIB)
   add_compile_definitions(HAS_QUADMATHLIB)
+  set(QUADMATHLIB quadmath)
 endif()
 
 add_flang_library(FortranEvaluate
@@ -61,6 +64,7 @@ add_flang_library(FortranEvaluate
   FortranDecimal
   FortranParser
   ${LIBPGMATH}
+  ${QUADMATHLIB}
 
   LINK_COMPONENTS
   Support

diff  --git a/flang/lib/Frontend/CMakeLists.txt b/flang/lib/Frontend/CMakeLists.txt
index d31ae5270e5c94..a06b610112f209 100644
--- a/flang/lib/Frontend/CMakeLists.txt
+++ b/flang/lib/Frontend/CMakeLists.txt
@@ -1,12 +1,6 @@
 get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
 get_property(extension_libs GLOBAL PROPERTY MLIR_EXTENSION_LIBS)
 
-check_include_file(quadmath.h FOUND_QUADMATH_HEADER)
-check_library_exists(quadmath sinq "" FOUND_QUADMATH_LIB)
-if(FOUND_QUADMATH_HEADER AND FOUND_QUADMATH_LIB)
-  set(QUADMATHLIB quadmath)
-endif()
-
 add_flang_library(flangFrontend
   CompilerInstance.cpp
   CompilerInvocation.cpp
@@ -48,7 +42,6 @@ add_flang_library(flangFrontend
   MLIRTargetLLVMIRImport
   ${dialect_libs}
   ${extension_libs}
-  ${QUADMATHLIB}
 
   LINK_COMPONENTS
   Passes

diff  --git a/flang/tools/bbc/CMakeLists.txt b/flang/tools/bbc/CMakeLists.txt
index 4c6273d1689225..cbae4ecd56c96c 100644
--- a/flang/tools/bbc/CMakeLists.txt
+++ b/flang/tools/bbc/CMakeLists.txt
@@ -12,12 +12,6 @@ llvm_update_compile_flags(bbc)
 get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
 get_property(extension_libs GLOBAL PROPERTY MLIR_EXTENSION_LIBS)
 
-check_include_file(quadmath.h FOUND_QUADMATH_HEADER)
-check_library_exists(quadmath sinq "" FOUND_QUADMATH_LIB)
-if(FOUND_QUADMATH_HEADER AND FOUND_QUADMATH_LIB)
-  set(QUADMATHLIB quadmath)
-endif()
-
 target_link_libraries(bbc PRIVATE
 FIRDialect
 FIRDialectSupport
@@ -35,5 +29,4 @@ FortranParser
 FortranEvaluate
 FortranSemantics
 FortranLower
-${QUADMATHLIB}
 )

diff  --git a/flang/unittests/Evaluate/CMakeLists.txt b/flang/unittests/Evaluate/CMakeLists.txt
index e4a4df31b2a2a5..4658d8d3345b5d 100644
--- a/flang/unittests/Evaluate/CMakeLists.txt
+++ b/flang/unittests/Evaluate/CMakeLists.txt
@@ -9,14 +9,8 @@ else()
   llvm_map_components_to_libnames(llvm_libs Support)
 endif()
 
-check_include_file(quadmath.h FOUND_QUADMATH_HEADER)
-check_library_exists(quadmath sinq "" FOUND_QUADMATH_LIB)
-if(FOUND_QUADMATH_HEADER AND FOUND_QUADMATH_LIB)
-  set(QUADMATHLIB quadmath)
-endif()
-
 target_link_libraries(FortranEvaluateTesting
-  ${llvm_libs} ${QUADMATHLIB})
+  ${llvm_libs})
 
 add_flang_nongtest_unittest(leading-zero-bit-count
   FortranEvaluateTesting


        


More information about the flang-commits mailing list