@@ -19,16 +19,20 @@ cmake_minimum_required(VERSION 2.8)
1919# In order to bootstrap the runtime library we need to skip
2020# CMake's Fortran tests
2121SET (CMAKE_Fortran_COMPILER_WORKS 1)
22+ SET (CMAKE_Fortran_ABI_COMPILED 0)
23+ SET (CMAKE_Fortran_COMPILER_SUPPORTS_F90 1)
24+ SET (CMAKE_Fortran_PREPROCESS_SOURCE
25+ "<CMAKE_Fortran_COMPILER> -cpp <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> -o <PREPROCESSED_SOURCE>" )
26+ SET (CMAKE_Fortran_MODDIR_FLAG "-module " )
2227
23- if ( NOT DEFINED TARGET_ARCHITECTURE )
24- execute_process (COMMAND uname -m OUTPUT_STRIP_TRAILING_WHITESPACE
25- OUTPUT_VARIABLE TARGET_ARCHITECTURE)
28+ # If we are not building as a part of LLVM, build Flang as an
29+ # standalone project, using LLVM as an external library:
30+ if ( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
31+ project (Flang)
2632endif ()
2733
28- if ( NOT DEFINED TARGET_OS )
29- execute_process (COMMAND uname -s OUTPUT_STRIP_TRAILING_WHITESPACE
30- OUTPUT_VARIABLE TARGET_OS)
31- endif ()
34+ set (TARGET_OS ${CMAKE_HOST_SYSTEM_NAME} CACHE STRING "Target OS" )
35+ set (TARGET_ARCHITECTURE ${CMAKE_HOST_SYSTEM_PROCESSOR} CACHE STRING "Target Architecture" )
3236
3337if ( ${TARGET_OS} STREQUAL "Linux" )
3438 set (OS "LINUX" )
@@ -54,11 +58,6 @@ else()
5458 return ()
5559endif ()
5660
57- # The cmake documentation states that these are set. They are not so we
58- # set them here
59- set (CMAKE_HOST_SYSTEM_NAME ${TARGET_OS} )
60- set (CMAKE_HOST_SYSTEM_PROCESSOR ${TARGET_ARCHITECTURE} )
61-
6261# If we are not building as a part of LLVM, build Flang as an
6362# standalone project, using LLVM as an external library:
6463if ( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
0 commit comments