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"
22 "${LLVM_CMAKE_UTILS}/modules"
27 include(HandleLLVMOptions)
29 include(TestBigEndian)
30 test_big_endian(IS_BIGENDIAN)
32 add_compile_definitions(FLANG_BIG_ENDIAN=1)
34 add_compile_definitions(FLANG_LITTLE_ENDIAN=1)
36 include_directories(BEFORE
37 ${FLANG_SOURCE_DIR}/include)
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)
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