Skip to content

Commit

Permalink
Try to unbreak unix
Browse files Browse the repository at this point in the history
  • Loading branch information
jmarrec committed Jun 15, 2021
1 parent be18e32 commit 92fbf39
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 11 deletions.
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,12 @@ add_subdirectory(src/ConvertInputFormat)

if(BUILD_FORTRAN)
include(CMakeAddFortranSubdirectory)
include(cmake/Fortran.cmake)
if (UNIX)
# Define a top-level target `fortran_project_options`
# It seems that CMakeAddFortranSubdirectory] doesn't know about the target `fortran_project_option` on Windows only.
# On Unix it is seen and detected as multiple targets defined with the same name (CMP0002)
include(cmake/Fortran.cmake)
endif()
cmake_add_fortran_subdirectory(
src/ExpandObjects
PROJECT ExpandObjects
Expand Down
6 changes: 5 additions & 1 deletion src/AppGPostProcess/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ set(SKIP_BUILD_RPATH TRUE)
add_executable(AppGPostProcess ${SRC})
set_target_properties(AppGPostProcess PROPERTIES FOLDER Auxiliary)

include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Fortran.cmake")
if(NOT UNIX) # Defined as top-level target on Unix only
include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Fortran.cmake")
endif()
get_target_property(F_INTERFACE_COMPILE_FLAGS fortran_project_options INTERFACE_COMPILE_OPTIONS)
message(DEBUG "AppGPostProcess: F_INTERFACE_COMPILE_FLAGS=${F_INTERFACE_COMPILE_FLAGS}")
target_link_libraries(AppGPostProcess PRIVATE fortran_project_options)

install(TARGETS AppGPostProcess DESTINATION PostProcess)
Expand Down
6 changes: 5 additions & 1 deletion src/Basement/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ add_executable(Basement ${SRC})
target_compile_options(Basement PRIVATE -O1)
set_target_properties(Basement PROPERTIES FOLDER Auxiliary)

include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Fortran.cmake")
if(NOT UNIX) # Defined as top-level target on Unix only
include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Fortran.cmake")
endif()
get_target_property(F_INTERFACE_COMPILE_FLAGS fortran_project_options INTERFACE_COMPILE_OPTIONS)
message(DEBUG "Basement: F_INTERFACE_COMPILE_FLAGS=${F_INTERFACE_COMPILE_FLAGS}")
target_link_libraries(Basement PRIVATE BasementOptions fortran_project_options)

install(TARGETS Basement DESTINATION PreProcess/GrndTempCalc)
Expand Down
6 changes: 5 additions & 1 deletion src/CalcSoilSurfTemp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ set(SKIP_BUILD_RPATH TRUE)
add_executable(CalcSoilSurfTemp ${SRC})
set_target_properties(CalcSoilSurfTemp PROPERTIES FOLDER Auxiliary)

include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Fortran.cmake")
if(NOT UNIX) # Defined as top-level target on Unix only
include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Fortran.cmake")
endif()
get_target_property(F_INTERFACE_COMPILE_FLAGS fortran_project_options INTERFACE_COMPILE_OPTIONS)
message(DEBUG "CalcSoilSurfTemp: F_INTERFACE_COMPILE_FLAGS=${F_INTERFACE_COMPILE_FLAGS}")
target_link_libraries(CalcSoilSurfTemp PRIVATE fortran_project_options)

install(TARGETS CalcSoilSurfTemp DESTINATION PreProcess/CalcSoilSurfTemp)
Expand Down
6 changes: 5 additions & 1 deletion src/ConvertESOMTR/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ set(SKIP_BUILD_RPATH TRUE)
add_executable(convertESOMTR ${SRC})
set_target_properties(convertESOMTR PROPERTIES FOLDER Auxiliary)

include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Fortran.cmake")
if(NOT UNIX) # Defined as top-level target on Unix only
include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Fortran.cmake")
endif()
get_target_property(F_INTERFACE_COMPILE_FLAGS fortran_project_options INTERFACE_COMPILE_OPTIONS)
message(DEBUG "ConvertESOMTR: F_INTERFACE_COMPILE_FLAGS=${F_INTERFACE_COMPILE_FLAGS}")
target_link_libraries(convertESOMTR PRIVATE fortran_project_options)

install(TARGETS convertESOMTR DESTINATION "PostProcess/convertESOMTRpgm/")
Expand Down
6 changes: 5 additions & 1 deletion src/ExpandObjects/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ set(SKIP_BUILD_RPATH TRUE)
add_executable(ExpandObjects ${SRC})
target_link_libraries(ExpandObjects PRIVATE fortran_project_options)

include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Fortran.cmake")
if(NOT UNIX) # Defined as top-level target on Unix only
include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Fortran.cmake")
endif()
get_target_property(F_INTERFACE_COMPILE_FLAGS fortran_project_options INTERFACE_COMPILE_OPTIONS)
message(DEBUG "ExpandObjects: F_INTERFACE_COMPILE_FLAGS=${F_INTERFACE_COMPILE_FLAGS}")
set_target_properties(ExpandObjects PROPERTIES FOLDER Auxiliary)

install(TARGETS ExpandObjects DESTINATION "./")
Expand Down
6 changes: 5 additions & 1 deletion src/HVAC-Diagram/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ set(SKIP_BUILD_RPATH true)
add_executable(HVAC-Diagram ${SRC})
set_target_properties(HVAC-Diagram PROPERTIES FOLDER Auxiliary)

include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Fortran.cmake")
if(NOT UNIX) # Defined as top-level target on Unix only
include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Fortran.cmake")
endif()
get_target_property(F_INTERFACE_COMPILE_FLAGS fortran_project_options INTERFACE_COMPILE_OPTIONS)
message(DEBUG "HVAC-Diagram: F_INTERFACE_COMPILE_FLAGS=${F_INTERFACE_COMPILE_FLAGS}")
target_link_libraries(HVAC-Diagram PRIVATE fortran_project_options)

if(NOT CMAKE_Fortran_COMPILER MATCHES "ifort")
Expand Down
6 changes: 5 additions & 1 deletion src/ParametricPreprocessor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ set(SKIP_BUILD_RPATH true)
add_executable(ParametricPreprocessor ${SRC})
set_target_properties(ParametricPreprocessor PROPERTIES FOLDER Auxiliary)

include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Fortran.cmake")
if(NOT UNIX) # Defined as top-level target on Unix only
include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Fortran.cmake")
endif()
get_target_property(F_INTERFACE_COMPILE_FLAGS fortran_project_options INTERFACE_COMPILE_OPTIONS)
message(DEBUG "ParametricPreprocessor: F_INTERFACE_COMPILE_FLAGS=${F_INTERFACE_COMPILE_FLAGS}")
target_link_libraries(ParametricPreprocessor PRIVATE fortran_project_options)

install(TARGETS ParametricPreprocessor DESTINATION PreProcess/ParametricPreprocessor)
Expand Down
6 changes: 5 additions & 1 deletion src/ReadVars/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ set(SKIP_BUILD_RPATH true)
add_executable(ReadVarsESO ${SRC})
set_target_properties(ReadVarsESO PROPERTIES FOLDER Auxiliary)

include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Fortran.cmake")
if(NOT UNIX) # Defined as top-level target on Unix only
include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Fortran.cmake")
endif()
get_target_property(F_INTERFACE_COMPILE_FLAGS fortran_project_options INTERFACE_COMPILE_OPTIONS)
message(DEBUG "ReadVars: F_INTERFACE_COMPILE_FLAGS=${F_INTERFACE_COMPILE_FLAGS}")
target_link_libraries(ReadVarsESO PRIVATE fortran_project_options)

install(TARGETS ReadVarsESO DESTINATION PostProcess)
Expand Down
6 changes: 5 additions & 1 deletion src/Slab/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ set(SKIP_BUILD_RPATH true)
add_executable(Slab ${SRC})
set_target_properties(Slab PROPERTIES FOLDER Auxiliary)

include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Fortran.cmake")
if(NOT UNIX) # Defined as top-level target on Unix only
include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Fortran.cmake")
endif()
get_target_property(F_INTERFACE_COMPILE_FLAGS fortran_project_options INTERFACE_COMPILE_OPTIONS)
message(DEBUG "Slab: F_INTERFACE_COMPILE_FLAGS=${F_INTERFACE_COMPILE_FLAGS}")
target_link_libraries(Slab PRIVATE fortran_project_options)

install(TARGETS Slab DESTINATION PreProcess/GrndTempCalc)
Expand Down
6 changes: 5 additions & 1 deletion src/Transition/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ add_library(TransitionLib STATIC ${LIB_SRC})
target_include_directories(TransitionLib PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_compile_options(TransitionLib PUBLIC -fbounds-check)

include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Fortran.cmake")
if(NOT UNIX) # Defined as top-level target on Unix only
include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Fortran.cmake")
endif()
get_target_property(F_INTERFACE_COMPILE_FLAGS fortran_project_options INTERFACE_COMPILE_OPTIONS)
message(DEBUG "Transition: F_INTERFACE_COMPILE_FLAGS=${F_INTERFACE_COMPILE_FLAGS}")
target_link_libraries(TransitionLib PUBLIC fortran_project_options) # ffree-line-length-none

set(VERSIONS
Expand Down

0 comments on commit 92fbf39

Please sign in to comment.