diff --git a/CMakeLists.txt b/CMakeLists.txt index 15ef5bc0290..0a75a8ec128 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -295,6 +295,8 @@ add_subdirectory(src/ConvertInputFormat) if(BUILD_FORTRAN) include(CMakeAddFortranSubdirectory) + include(cmake/Fortran.cmake) + cmake_add_fortran_subdirectory( src/ExpandObjects PROJECT ExpandObjects diff --git a/src/AppGPostProcess/CMakeLists.txt b/src/AppGPostProcess/CMakeLists.txt index 7c405012d28..b13180bf548 100644 --- a/src/AppGPostProcess/CMakeLists.txt +++ b/src/AppGPostProcess/CMakeLists.txt @@ -10,55 +10,14 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../../Products") set(SRC AppGPostProcess.f90) -set(STATIC_EXE FALSE) - -add_library(AppGPostProcessOptions INTERFACE) -if(APPLE) - if(CMAKE_Fortran_COMPILER MATCHES "ifort") - target_compile_options(AppGPostProcessOptions INTERFACE -fpp) - target_compile_options(AppGPostProcessOptions INTERFACE -static-intel) - else() - if(NOT "Ninja" STREQUAL ${CMAKE_GENERATOR}) - target_compile_options(AppGPostProcessOptions INTERFACE -cpp) - endif() - target_compile_options(AppGPostProcessOptions INTERFACE -ffree-line-length-200) - endif() -elseif(UNIX) - set(CMAKE_SKIP_RPATH TRUE) - if(CMAKE_Fortran_COMPILER MATCHES "ifort") - target_compile_options(AppGPostProcessOptions INTERFACE -fpp) - target_compile_options(AppGPostProcessOptions INTERFACE -static-intel) - else() - if(NOT "Ninja" STREQUAL ${CMAKE_GENERATOR}) - target_compile_options(AppGPostProcessOptions INTERFACE -cpp) - endif() - target_compile_options(AppGPostProcessOptions INTERFACE -static) - target_compile_options(AppGPostProcessOptions INTERFACE -ffree-line-length-200) - set(STATIC_EXE TRUE) - endif() -else() # Windows - set(STATIC_EXE TRUE) - if(CMAKE_Fortran_COMPILER MATCHES "ifort") - # Set release flags to be empty - set(CMAKE_Fortran_FLAGS_RELEASE "") - target_compile_options(AppGPostProcessOptions INTERFACE /libs:static) - target_compile_options(AppGPostProcessOptions INTERFACE /fpp) - else() - target_compile_options(AppGPostProcessOptions INTERFACE -static) - if(NOT "Ninja" STREQUAL ${CMAKE_GENERATOR}) - target_compile_options(AppGPostProcessOptions INTERFACE -cpp) - endif() - target_compile_options(AppGPostProcessOptions INTERFACE -ffree-line-length-200) - endif() -endif() - set(SKIP_BUILD_RPATH TRUE) +set(CMAKE_SKIP_RPATH ${FORTRAN_SKIP_RPATH}) add_executable(AppGPostProcess ${SRC}) -target_link_libraries(AppGPostProcess PRIVATE AppGPostProcessOptions) +target_link_libraries(AppGPostProcess PRIVATE fortran_project_options) set_target_properties(AppGPostProcess PROPERTIES FOLDER Auxiliary) install(TARGETS AppGPostProcess DESTINATION PostProcess) -if(NOT ${STATIC_EXE}) +if(NOT ${FORTRAN_STATIC_EXE}) include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/ProjectMacros.cmake") install_target_prereqs(AppGPostProcess PostProcess) endif() diff --git a/src/Basement/CMakeLists.txt b/src/Basement/CMakeLists.txt index 792f761e37b..4a27abd2fdb 100644 --- a/src/Basement/CMakeLists.txt +++ b/src/Basement/CMakeLists.txt @@ -19,29 +19,13 @@ set(SRC InputProcessor.f90 BasementSimData.f90) -set(STATIC_EXE FALSE) - add_library(BasementOptions INTERFACE) -if(APPLE) - if(CMAKE_Fortran_COMPILER MATCHES "ifort") - target_compile_options(BasementOptions INTERFACE -static-intel) - else() - target_compile_options(BasementOptions INTERFACE -ffloat-store) - endif() -elseif(UNIX) - set(CMAKE_SKIP_RPATH TRUE) - if(CMAKE_Fortran_COMPILER MATCHES "ifort") - target_compile_options(BasementOptions INTERFACE -static-intel) - else() - target_compile_options(BasementOptions INTERFACE -ffloat-store) - target_compile_options(BasementOptions INTERFACE -static) - set(STATIC_EXE TRUE) - endif() -else() # Windows - set(STATIC_EXE TRUE) +if(NOT CMAKE_Fortran_COMPILER MATCHES "ifort") + target_compile_options(BasementOptions INTERFACE -ffloat-store) +endif() + +if(NOT APPLE AND NOT UNIX) # Windows if(CMAKE_Fortran_COMPILER MATCHES "ifort") - # Set release flags to be empty - set(CMAKE_Fortran_FLAGS_RELEASE "") target_compile_options( BasementOptions INTERFACE /nologo @@ -64,23 +48,21 @@ else() # Windows /Qimf-precision:high /Qimf-arch-consistency:true /Qvec-) - else() - target_compile_options(BasementOptions INTERFACE -static) - target_compile_options(BasementOptions INTERFACE -ffloat-store) endif() endif() +set(CMAKE_SKIP_RPATH ${FORTRAN_SKIP_RPATH}) set(SKIP_BUILD_RPATH TRUE) add_executable(Basement ${SRC}) set_target_properties( Basement PROPERTIES COMPILE_FLAGS - "-O1 -ffree-line-length-200") + "-O1") set_target_properties(Basement PROPERTIES FOLDER Auxiliary) -target_link_libraries(Basement PRIVATE BasementOptions) +target_link_libraries(Basement PRIVATE BasementOptions fortran_project_options) install(TARGETS Basement DESTINATION PreProcess/GrndTempCalc) -if(NOT ${STATIC_EXE}) +if(NOT ${FORTRAN_STATIC_EXE}) include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/ProjectMacros.cmake") install_target_prereqs(Basement PreProcess/GrndTempCalc) endif() diff --git a/src/CalcSoilSurfTemp/CMakeLists.txt b/src/CalcSoilSurfTemp/CMakeLists.txt index 3894fde90f2..a477b63c35c 100644 --- a/src/CalcSoilSurfTemp/CMakeLists.txt +++ b/src/CalcSoilSurfTemp/CMakeLists.txt @@ -10,56 +10,14 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../../Products") set(SRC EPWRead.f90 SoilSurfTemp.f90) -set(STATIC_EXE FALSE) - -add_library(CalcSoilSurfTempOptions INTERFACE) - -if(APPLE) - if(CMAKE_Fortran_COMPILER MATCHES "ifort") - target_compile_options(CalcSoilSurfTempOptions INTERFACE -fpp) - target_compile_options(CalcSoilSurfTempOptions INTERFACE -static-intel) - else() - if(NOT "Ninja" STREQUAL ${CMAKE_GENERATOR}) - target_compile_options(CalcSoilSurfTempOptions INTERFACE -cpp) - endif() - target_compile_options(CalcSoilSurfTempOptions INTERFACE -ffree-line-length-200) - endif() -elseif(UNIX) - set(CMAKE_SKIP_RPATH TRUE) - if(CMAKE_Fortran_COMPILER MATCHES "ifort") - target_compile_options(CalcSoilSurfTempOptions INTERFACE -fpp) - target_compile_options(CalcSoilSurfTempOptions INTERFACE -static-intel) - else() - if(NOT "Ninja" STREQUAL ${CMAKE_GENERATOR}) - target_compile_options(CalcSoilSurfTempOptions INTERFACE -cpp) - endif() - target_compile_options(CalcSoilSurfTempOptions INTERFACE -static) - target_compile_options(CalcSoilSurfTempOptions INTERFACE -ffree-line-length-200) - set(STATIC_EXE TRUE) - endif() -else() # Windows - set(STATIC_EXE TRUE) - if(CMAKE_Fortran_COMPILER MATCHES "ifort") - # Set release flags to be empty - set(CMAKE_Fortran_FLAGS_RELEASE "") - target_compile_options(CalcSoilSurfTempOptions INTERFACE /libs:static) - target_compile_options(CalcSoilSurfTempOptions INTERFACE /fpp) - else() - target_compile_options(CalcSoilSurfTempOptions INTERFACE -static) - if(NOT "Ninja" STREQUAL ${CMAKE_GENERATOR}) - target_compile_options(CalcSoilSurfTempOptions INTERFACE -cpp) - endif() - target_compile_options(CalcSoilSurfTempOptions INTERFACE -ffree-line-length-200) - endif() -endif() - +set(CMAKE_SKIP_RPATH ${FORTRAN_SKIP_RPATH}) set(SKIP_BUILD_RPATH TRUE) add_executable(CalcSoilSurfTemp ${SRC}) -target_link_libraries(CalcSoilSurfTemp PRIVATE CalcSoilSurfTempOptions) +target_link_libraries(CalcSoilSurfTemp PRIVATE fortran_project_options) set_target_properties(CalcSoilSurfTemp PROPERTIES FOLDER Auxiliary) install(TARGETS CalcSoilSurfTemp DESTINATION PreProcess/CalcSoilSurfTemp) -if(NOT ${STATIC_EXE}) +if(NOT ${FORTRAN_STATIC_EXE}) include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/ProjectMacros.cmake") install_target_prereqs(CalcSoilSurfTemp PreProcess/CalcSoilSurfTemp) endif() diff --git a/src/ConvertESOMTR/CMakeLists.txt b/src/ConvertESOMTR/CMakeLists.txt index d736d8f0575..d922539e1b4 100644 --- a/src/ConvertESOMTR/CMakeLists.txt +++ b/src/ConvertESOMTR/CMakeLists.txt @@ -10,40 +10,16 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../../Products") set(SRC mainModule.f90) -set(STATIC_EXE FALSE) - set(SKIP_BUILD_RPATH TRUE) +set(CMAKE_SKIP_RPATH ${FORTRAN_SKIP_RPATH}) + add_executable(convertESOMTR ${SRC}) set_target_properties(convertESOMTR PROPERTIES FOLDER Auxiliary) -add_library(convertESOMTROptions INTERFACE) - -if(APPLE) - if(CMAKE_Fortran_COMPILER MATCHES "ifort") - target_compile_options(convertESOMTROptions INTERFACE -static-intel) - endif() -elseif(UNIX) - set(CMAKE_SKIP_RPATH TRUE) - if(CMAKE_Fortran_COMPILER MATCHES "ifort") - target_compile_options(convertESOMTROptions INTERFACE -static-intel) - else() - target_compile_options(convertESOMTROptions INTERFACE -static) - set(STATIC_EXE TRUE) - endif() -else() - set(STATIC_EXE TRUE) - if(CMAKE_Fortran_COMPILER MATCHES "ifort") - # Set release flags to be empty - set(CMAKE_Fortran_FLAGS_RELEASE "") - target_compile_options(convertESOMTROptions INTERFACE /libs:static) - else() - target_compile_options(convertESOMTROptions INTERFACE -static) - endif() -endif() -target_link_libraries(convertESOMTR PRIVATE convertESOMTROptions) +target_link_libraries(convertESOMTR PRIVATE fortran_project_options) install(TARGETS convertESOMTR DESTINATION "PostProcess/convertESOMTRpgm/") -if(NOT ${STATIC_EXE}) +if(NOT ${FORTRAN_STATIC_EXE}) include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/ProjectMacros.cmake") install_target_prereqs(convertESOMTR "PostProcess/convertESOMTRpgm/") endif() diff --git a/src/ExpandObjects/CMakeLists.txt b/src/ExpandObjects/CMakeLists.txt index 1750eb33a31..b99747e1347 100644 --- a/src/ExpandObjects/CMakeLists.txt +++ b/src/ExpandObjects/CMakeLists.txt @@ -14,61 +14,20 @@ endif() set(SRC epfilter.f90) -set(STATIC_EXE FALSE) - -add_library(ExpandObjectsOptions INTERFACE) - -if(APPLE) - if(CMAKE_Fortran_COMPILER MATCHES "ifort") - target_compile_options(ExpandObjectsOptions INTERFACE -fpp) - target_compile_options(ExpandObjectsOptions INTERFACE -static-intel) - else() - if(NOT "Ninja" STREQUAL ${CMAKE_GENERATOR}) - target_compile_options(ExpandObjectsOptions INTERFACE -cpp) - endif() - target_compile_options(ExpandObjectsOptions INTERFACE -ffree-line-length-200) - endif() -elseif(UNIX) - set(CMAKE_SKIP_RPATH TRUE) - if(CMAKE_Fortran_COMPILER MATCHES "ifort") - target_compile_options(ExpandObjectsOptions INTERFACE -fpp) - target_compile_options(ExpandObjectsOptions INTERFACE -static-intel) - else() - if(NOT "Ninja" STREQUAL ${CMAKE_GENERATOR}) - target_compile_options(ExpandObjectsOptions INTERFACE -cpp) - endif() - target_compile_options(ExpandObjectsOptions INTERFACE -static) - target_compile_options(ExpandObjectsOptions INTERFACE -ffree-line-length-200) - set(STATIC_EXE TRUE) - endif() -else() # Windows - set(STATIC_EXE TRUE) - if(CMAKE_Fortran_COMPILER MATCHES "ifort") - # Set release flags to be empty - set(CMAKE_Fortran_FLAGS_RELEASE "") - target_compile_options(ExpandObjectsOptions INTERFACE /libs:static) - target_compile_options(ExpandObjectsOptions INTERFACE /fpp) - else() - target_compile_options(ExpandObjectsOptions INTERFACE -static) - if(NOT "Ninja" STREQUAL ${CMAKE_GENERATOR}) - target_compile_options(ExpandObjectsOptions INTERFACE -cpp) - endif() - target_compile_options(ExpandObjectsOptions INTERFACE -ffree-line-length-200) - endif() -endif() - set(SKIP_BUILD_RPATH TRUE) +set(CMAKE_SKIP_RPATH ${FORTRAN_SKIP_RPATH}) + if(APPLE OR UNIX) add_executable(ExpandObjects ${SRC}) else() # windows add_executable(ExpandObjects ${SRC} "${CMAKE_CURRENT_BINARY_DIR}/ExpandObjects.rc") endif() -target_link_libraries(ExpandObjects ExpandObjectsOptions) +target_link_libraries(ExpandObjects PRIVATE fortran_project_options) set_target_properties(ExpandObjects PROPERTIES FOLDER Auxiliary) install(TARGETS ExpandObjects DESTINATION "./") -if(NOT ${STATIC_EXE}) +if(NOT ${FORTRAN_STATIC_EXE}) include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/ProjectMacros.cmake") install_target_prereqs(ExpandObjects "./") endif() diff --git a/src/HVAC-Diagram/CMakeLists.txt b/src/HVAC-Diagram/CMakeLists.txt index 3f8ce8aa84d..fab0afbe149 100644 --- a/src/HVAC-Diagram/CMakeLists.txt +++ b/src/HVAC-Diagram/CMakeLists.txt @@ -10,47 +10,19 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../../Products") set(SRC HVAC-Diagram-Main.f90) -set(STATIC_EXE TRUE) - -add_library(HVAC-Diagram-Options INTERFACE) - -if(APPLE) - if(CMAKE_Fortran_COMPILER MATCHES "ifort") - target_compile_options(HVAC-Diagram-Options INTERFACE -static-intel) - else() - target_compile_options(HVAC-Diagram-Options INTERFACE -std=legacy) - target_compile_options(HVAC-Diagram-Options INTERFACE -ffree-line-length-200) - endif() -elseif(UNIX) - set(CMAKE_SKIP_RPATH TRUE) - if(CMAKE_Fortran_COMPILER MATCHES "ifort") - target_compile_options(HVAC-Diagram-Options INTERFACE -static-intel) - else() - target_compile_options(HVAC-Diagram-Options INTERFACE -static) - target_compile_options(HVAC-Diagram-Options INTERFACE -std=legacy) - target_compile_options(HVAC-Diagram-Options INTERFACE -ffree-line-length-200) - set(STATIC_EXE TRUE) - endif() -else() - if(CMAKE_Fortran_COMPILER MATCHES "ifort") - # Set release flags to be empty - set(CMAKE_Fortran_FLAGS_RELEASE "") - target_compile_options(HVAC-Diagram-Options INTERFACE /libs:static) - else() - target_compile_options(HVAC-Diagram-Options INTERFACE -static) - target_compile_options(HVAC-Diagram-Options INTERFACE -std=legacy) - target_compile_options(HVAC-Diagram-Options INTERFACE -ffree-line-length-200) - set(STATIC_EXE TRUE) - endif() -endif() set(SKIP_BUILD_RPATH true) +set(CMAKE_SKIP_RPATH ${FORTRAN_SKIP_RPATH}) add_executable(HVAC-Diagram ${SRC}) -target_link_libraries(HVAC-Diagram PRIVATE HVAC-Diagram-Options) +target_link_libraries(HVAC-Diagram PRIVATE fortran_project_options) set_target_properties(HVAC-Diagram PROPERTIES FOLDER Auxiliary) +if(NOT CMAKE_Fortran_COMPILER MATCHES "ifort") + target_compile_options(HVAC-Diagram PRIVATE -std=legacy) +endif() + install(TARGETS HVAC-Diagram DESTINATION PostProcess) -if(NOT ${STATIC_EXE}) +if(NOT ${FORTRAN_STATIC_EXE}) include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/ProjectMacros.cmake") install_target_prereqs(HVAC-Diagram PostProcess) endif() diff --git a/src/ParametricPreprocessor/CMakeLists.txt b/src/ParametricPreprocessor/CMakeLists.txt index 1055b16689b..a9ba1ee99f0 100644 --- a/src/ParametricPreprocessor/CMakeLists.txt +++ b/src/ParametricPreprocessor/CMakeLists.txt @@ -10,43 +10,17 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../../Products") set(SRC ParametricPreprocessor.f90) -add_library(ParametricPreprocessorOptions INTERFACE) - -set(STATIC_EXE FALSE) - -if(APPLE) - if(CMAKE_Fortran_COMPILER MATCHES "ifort") - target_compile_options(ParametricPreprocessorOptions INTERFACE -static-intel) - endif() -elseif(UNIX) - set(CMAKE_SKIP_RPATH TRUE) - if(CMAKE_Fortran_COMPILER MATCHES "ifort") - target_compile_options(ParametricPreprocessorOptions INTERFACE -static-intel) - else() - target_compile_options(ParametricPreprocessorOptions INTERFACE -static) - set(STATIC_EXE TRUE) - endif() -else() - set(STATIC_EXE TRUE) - if(CMAKE_Fortran_COMPILER MATCHES "ifort") - # Set release flags to be empty - set(CMAKE_Fortran_FLAGS_RELEASE "") - target_compile_options(ParametricPreprocessorOptions INTERFACE /libs:static) - else() - target_compile_options(ParametricPreprocessorOptions INTERFACE -static) - endif() -endif() set(SKIP_BUILD_RPATH true) +set(CMAKE_SKIP_RPATH ${FORTRAN_SKIP_RPATH}) + add_executable(ParametricPreprocessor ${SRC}) -target_link_libraries(ParametricPreprocessor PRIVATE ParametricPreprocessorOptions) +target_link_libraries(ParametricPreprocessor PRIVATE fortran_project_options) set_target_properties(ParametricPreprocessor PROPERTIES FOLDER Auxiliary) -set_target_properties(ParametricPreprocessor PROPERTIES COMPILE_FLAGS -ffree-line-length-200) - install(TARGETS ParametricPreprocessor DESTINATION PreProcess/ParametricPreprocessor) -if(NOT ${STATIC_EXE}) +if(NOT ${FORTRAN_STATIC_EXE}) include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/ProjectMacros.cmake") install_target_prereqs(ParametricPreprocessor PreProcess/ParametricPreprocessor) endif() diff --git a/src/ReadVars/CMakeLists.txt b/src/ReadVars/CMakeLists.txt index 4a20fd94833..a9bf1c9f416 100644 --- a/src/ReadVars/CMakeLists.txt +++ b/src/ReadVars/CMakeLists.txt @@ -10,41 +10,13 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../../Products") set(SRC ReadVarsESO.f90) -set(STATIC_EXE FALSE) - -add_library(ReadVarsOptions INTERFACE) - - -if(APPLE) - if(CMAKE_Fortran_COMPILER MATCHES "ifort") - target_compile_options(ReadVarsOptions INTERFACE -static-intel) - endif() -elseif(UNIX) - set(CMAKE_SKIP_RPATH TRUE) - if(CMAKE_Fortran_COMPILER MATCHES "ifort") - target_compile_options(ReadVarsOptions INTERFACE -static-intel) - else() - target_compile_options(ReadVarsOptions INTERFACE -static) - set(STATIC_EXE TRUE) - endif() -else() - set(STATIC_EXE TRUE) - if(CMAKE_Fortran_COMPILER MATCHES "ifort") - # Set release flags to be empty - set(CMAKE_Fortran_FLAGS_RELEASE "") - target_compile_options(ReadVarsOptions INTERFACE /libs:static) - else() - target_compile_options(ReadVarsOptions INTERFACE -static) - endif() -endif() - set(SKIP_BUILD_RPATH true) add_executable(ReadVarsESO ${SRC}) set_target_properties(ReadVarsESO PROPERTIES FOLDER Auxiliary) -target_link_libraries(ReadVarsESO PRIVATE ReadVarsOptions) +target_link_libraries(ReadVarsESO PRIVATE fortran_project_options) install(TARGETS ReadVarsESO DESTINATION PostProcess) -if(NOT ${STATIC_EXE}) +if(NOT ${FORTRAN_STATIC_EXE}) include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/ProjectMacros.cmake") install_target_prereqs(ReadVarsESO PostProcess) endif() diff --git a/src/Slab/CMakeLists.txt b/src/Slab/CMakeLists.txt index 42d64556eaf..2c99aa6208b 100644 --- a/src/Slab/CMakeLists.txt +++ b/src/Slab/CMakeLists.txt @@ -22,42 +22,14 @@ set(SRC InputProcessor.f90 SimData.f90) -set(STATIC_EXE FALSE) - -add_library(SlabOptions INTERFACE) - -if(APPLE) - if(CMAKE_Fortran_COMPILER MATCHES "ifort") - target_compile_options(SlabOptions INTERFACE -static-intel) - endif() -elseif(UNIX) - set(CMAKE_SKIP_RPATH TRUE) - if(CMAKE_Fortran_COMPILER MATCHES "ifort") - target_compile_options(SlabOptions INTERFACE -static-intel) - else() - target_compile_options(SlabOptions INTERFACE -static) - set(STATIC_EXE TRUE) - endif() -else() - if(CMAKE_Fortran_COMPILER MATCHES "ifort") - # Set release flags to be empty - set(CMAKE_Fortran_FLAGS_RELEASE "") - target_compile_options(SlabOptions INTERFACE /libs:static) - else() - target_compile_options(SlabOptions INTERFACE -static) - set(STATIC_EXE TRUE) - endif() -endif() - set(SKIP_BUILD_RPATH TRUE) +set(CMAKE_SKIP_RPATH ${CMAKE_SKIP_RPATH}) add_executable(Slab ${SRC}) -target_link_libraries(Slab PRIVATE SlabOptions) +target_link_libraries(Slab PRIVATE fortran_project_options) set_target_properties(Slab PROPERTIES FOLDER Auxiliary) -set_target_properties(Slab PROPERTIES COMPILE_FLAGS "-ffree-line-length-200") - install(TARGETS Slab DESTINATION PreProcess/GrndTempCalc) -if(NOT ${STATIC_EXE}) +if(NOT ${FORTRAN_STATIC_EXE}) include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/ProjectMacros.cmake") install_target_prereqs(Slab PreProcess/GrndTempCalc) endif() diff --git a/src/Transition/CMakeLists.txt b/src/Transition/CMakeLists.txt index 1067dd9bbfa..fb42f941e6c 100644 --- a/src/Transition/CMakeLists.txt +++ b/src/Transition/CMakeLists.txt @@ -8,7 +8,7 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../../Products") set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../../Products") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../../Products") -set(STATIC_EXE FALSE) +set(CMAKE_SKIP_RPATH ${FORTRAN_SKIP_RPATH}) # first create a static library of shared stuff set(LIB_SRC @@ -66,51 +66,8 @@ list(APPEND VERSIONS 9_2_0) list(APPEND VERSIONS 9_3_0) list(APPEND VERSIONS 9_4_0) -add_library(TransitionOptions INTERFACE) - -if(APPLE) - if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU") - if(NOT "Ninja" STREQUAL ${CMAKE_GENERATOR}) - target_compile_options(TransitionOptions INTERFACE -cpp) - endif() - target_compile_options(TransitionOptions INTERFACE -ffree-line-length-none) - target_compile_options(TransitionOptions INTERFACE -fbounds-check) - else() - target_compile_options(TransitionOptions INTERFACE -fpp) - target_compile_options(TransitionOptions INTERFACE -static-intel) - endif() -elseif(UNIX) - set(CMAKE_SKIP_RPATH TRUE) - if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU") - target_compile_options(TransitionOptions INTERFACE -static) - if(NOT "Ninja" STREQUAL ${CMAKE_GENERATOR}) - target_compile_options(TransitionOptions INTERFACE -cpp) - endif() - target_compile_options(TransitionOptions INTERFACE -ffree-line-length-none) - target_compile_options(TransitionOptions INTERFACE -fbounds-check) - set(STATIC_EXE TRUE) - else() - target_compile_options(TransitionOptions INTERFACE -fpp) - target_compile_options(TransitionOptions INTERFACE -static-intel) - endif() -else() # Windows - set(STATIC_EXE TRUE) - if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU") - target_compile_options(TransitionOptions INTERFACE -static) - if(NOT "Ninja" STREQUAL ${CMAKE_GENERATOR}) - target_compile_options(TransitionOptions INTERFACE -cpp) - endif() - target_compile_options(TransitionOptions INTERFACE -ffree-line-length-none) - target_compile_options(TransitionOptions INTERFACE -fbounds-check) - else() - # Set release flags to be empty - set(CMAKE_Fortran_FLAGS_RELEASE "") - target_compile_options(TransitionOptions INTERFACE /libs:static) - target_compile_options(TransitionOptions INTERFACE /fpp) - endif() -endif() - -target_link_libraries(TransitionLib PRIVATE TransitionOptions) +target_compile_options(TransitionLib PUBLIC -fbounds-check) +target_link_libraries(TransitionLib PUBLIC fortran_project_options) list(LENGTH VERSIONS VERSIONS_SIZE) @@ -136,11 +93,11 @@ foreach(i RANGE 1 ${end}) set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${LAST_NAME}) add_executable("${LAST_NAME}" ${SRC}) set_target_properties("${LAST_NAME}" PROPERTIES FOLDER Auxiliary) - target_link_libraries("${LAST_NAME}" PRIVATE TransitionLib TransitionOptions) + target_link_libraries("${LAST_NAME}" PRIVATE TransitionLib) if("${i}" GREATER "22") install(TARGETS "${LAST_NAME}" DESTINATION PreProcess/IDFVersionUpdater) - if(NOT ${STATIC_EXE}) + if(NOT ${FORTRAN_STATIC_EXE}) install_target_prereqs("${LAST_NAME}" PreProcess/IDFVersionUpdater) endif() endif()