Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / lib / Decimal / CMakeLists.txt
blob5c5a498f1a3ca52dc39c9e842551eee013ecf770
1 if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
2   cmake_minimum_required(VERSION 3.13.4)
4   project(FortranDecimal C CXX)
6   set(CMAKE_CXX_STANDARD 17)
7   set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
8   set(CMAKE_CXX_EXTENSIONS OFF)
10   set(FLANG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../..")
12   set(LLVM_COMMON_CMAKE_UTILS "${FLANG_SOURCE_DIR}/../cmake")
13   set(LLVM_CMAKE_UTILS "${FLANG_SOURCE_DIR}/../llvm/cmake")
15   # Add path for custom modules
16   list(INSERT CMAKE_MODULE_PATH 0
17     "${FLANG_SOURCE_DIR}/cmake"
18     "${FLANG_SOURCE_DIR}/cmake/modules"
19     "${LLVM_COMMON_CMAKE_UTILS}"
20     "${LLVM_COMMON_CMAKE_UTILS}/Modules"
21     "${LLVM_CMAKE_UTILS}"
22     "${LLVM_CMAKE_UTILS}/modules"
23     )
25   include(AddLLVM)
26   include(AddFlang)
27   include(HandleLLVMOptions)
29   include(TestBigEndian)
30   test_big_endian(IS_BIGENDIAN)
31   if (IS_BIGENDIAN)
32     add_compile_definitions(FLANG_BIG_ENDIAN=1)
33   else ()
34     add_compile_definitions(FLANG_LITTLE_ENDIAN=1)
35   endif ()
36   include_directories(BEFORE
37     ${FLANG_SOURCE_DIR}/include)
38 endif()
40 check_cxx_compiler_flag(-fno-lto FLANG_RUNTIME_HAS_FNO_LTO_FLAG)
41 if (FLANG_RUNTIME_HAS_FNO_LTO_FLAG)
42   append("-fno-lto" CMAKE_CXX_FLAGS)
43 endif()
45 # Disable libstdc++ assertions, even in an LLVM_ENABLE_ASSERTIONS build, to
46 # avoid an unwanted dependency on libstdc++.so.
47 add_definitions(-U_GLIBCXX_ASSERTIONS)
49 add_flang_library(FortranDecimal INSTALL_WITH_TOOLCHAIN
50   binary-to-decimal.cpp
51   decimal-to-binary.cpp