1 if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
2 cmake_minimum_required(VERSION 3.20.0)
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")
14 set(CLANG_CMAKE_UTILS "${FLANG_SOURCE_DIR}/../clang/cmake")
16 # Add path for custom modules
17 list(INSERT CMAKE_MODULE_PATH 0
18 "${FLANG_SOURCE_DIR}/cmake"
19 "${FLANG_SOURCE_DIR}/cmake/modules"
20 "${LLVM_COMMON_CMAKE_UTILS}"
21 "${LLVM_COMMON_CMAKE_UTILS}/Modules"
23 "${LLVM_CMAKE_UTILS}/modules"
24 "${CLANG_CMAKE_UTILS}/modules"
30 include(HandleLLVMOptions)
32 include(TestBigEndian)
33 test_big_endian(IS_BIGENDIAN)
35 add_compile_definitions(FLANG_BIG_ENDIAN=1)
37 add_compile_definitions(FLANG_LITTLE_ENDIAN=1)
39 include_directories(BEFORE
40 ${FLANG_SOURCE_DIR}/include)
43 check_cxx_compiler_flag(-fno-lto FLANG_RUNTIME_HAS_FNO_LTO_FLAG)
44 if (FLANG_RUNTIME_HAS_FNO_LTO_FLAG)
45 append("-fno-lto" CMAKE_CXX_FLAGS)
48 # Disable libstdc++ assertions, even in an LLVM_ENABLE_ASSERTIONS build, to
49 # avoid an unwanted dependency on libstdc++.so.
50 add_definitions(-U_GLIBCXX_ASSERTIONS)
57 include(AddFlangOffloadRuntime)
58 enable_cuda_compilation(FortranDecimal "${sources}")
59 enable_omp_offload_compilation("${sources}")
61 add_flang_library(FortranDecimal INSTALL_WITH_TOOLCHAIN ${sources})
64 set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded)
65 add_flang_library(FortranDecimal.static INSTALL_WITH_TOOLCHAIN
69 set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDLL)
70 add_flang_library(FortranDecimal.dynamic INSTALL_WITH_TOOLCHAIN
74 set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDebug)
75 add_flang_library(FortranDecimal.static_dbg INSTALL_WITH_TOOLCHAIN
79 set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDebugDLL)
80 add_flang_library(FortranDecimal.dynamic_dbg INSTALL_WITH_TOOLCHAIN
84 add_dependencies(FortranDecimal FortranDecimal.static FortranDecimal.dynamic
85 FortranDecimal.static_dbg FortranDecimal.dynamic_dbg)