Skip to content

Commit

Permalink
Apparently on windows I need to define it both at top level and in ea…
Browse files Browse the repository at this point in the history
…ch fortran subdirectory

On Unix it is seen and detected as multiple targets defined with the same name (CMP0002), so only do it once at top level.
  • Loading branch information
jmarrec committed Jun 15, 2021
1 parent 92fbf39 commit 6670e31
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 16 deletions.
8 changes: 2 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -326,12 +326,8 @@ add_subdirectory(src/ConvertInputFormat)

if(BUILD_FORTRAN)
include(CMakeAddFortranSubdirectory)
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()
# Define a top-level target `fortran_project_options`
include(cmake/Fortran.cmake)
cmake_add_fortran_subdirectory(
src/ExpandObjects
PROJECT ExpandObjects
Expand Down
2 changes: 1 addition & 1 deletion src/AppGPostProcess/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ set(SKIP_BUILD_RPATH TRUE)
add_executable(AppGPostProcess ${SRC})
set_target_properties(AppGPostProcess PROPERTIES FOLDER Auxiliary)

if(NOT UNIX) # Defined as top-level target on Unix only
if(NOT UNIX) # Need to reinclude it on Windows
include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Fortran.cmake")
endif()
get_target_property(F_INTERFACE_COMPILE_FLAGS fortran_project_options INTERFACE_COMPILE_OPTIONS)
Expand Down
2 changes: 1 addition & 1 deletion src/Basement/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ add_executable(Basement ${SRC})
target_compile_options(Basement PRIVATE -O1)
set_target_properties(Basement PROPERTIES FOLDER Auxiliary)

if(NOT UNIX) # Defined as top-level target on Unix only
if(NOT UNIX) # Need to reinclude it on Windows
include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Fortran.cmake")
endif()
get_target_property(F_INTERFACE_COMPILE_FLAGS fortran_project_options INTERFACE_COMPILE_OPTIONS)
Expand Down
2 changes: 1 addition & 1 deletion src/CalcSoilSurfTemp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ set(SKIP_BUILD_RPATH TRUE)
add_executable(CalcSoilSurfTemp ${SRC})
set_target_properties(CalcSoilSurfTemp PROPERTIES FOLDER Auxiliary)

if(NOT UNIX) # Defined as top-level target on Unix only
if(NOT UNIX) # Need to reinclude it on Windows
include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Fortran.cmake")
endif()
get_target_property(F_INTERFACE_COMPILE_FLAGS fortran_project_options INTERFACE_COMPILE_OPTIONS)
Expand Down
2 changes: 1 addition & 1 deletion src/ConvertESOMTR/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ set(SKIP_BUILD_RPATH TRUE)
add_executable(convertESOMTR ${SRC})
set_target_properties(convertESOMTR PROPERTIES FOLDER Auxiliary)

if(NOT UNIX) # Defined as top-level target on Unix only
if(NOT UNIX) # Need to reinclude it on Windows
include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Fortran.cmake")
endif()
get_target_property(F_INTERFACE_COMPILE_FLAGS fortran_project_options INTERFACE_COMPILE_OPTIONS)
Expand Down
2 changes: 1 addition & 1 deletion src/ExpandObjects/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ set(SKIP_BUILD_RPATH TRUE)
add_executable(ExpandObjects ${SRC})
target_link_libraries(ExpandObjects PRIVATE fortran_project_options)

if(NOT UNIX) # Defined as top-level target on Unix only
if(NOT UNIX) # Need to reinclude it on Windows
include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Fortran.cmake")
endif()
get_target_property(F_INTERFACE_COMPILE_FLAGS fortran_project_options INTERFACE_COMPILE_OPTIONS)
Expand Down
2 changes: 1 addition & 1 deletion src/HVAC-Diagram/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ set(SKIP_BUILD_RPATH true)
add_executable(HVAC-Diagram ${SRC})
set_target_properties(HVAC-Diagram PROPERTIES FOLDER Auxiliary)

if(NOT UNIX) # Defined as top-level target on Unix only
if(NOT UNIX) # Need to reinclude it on Windows
include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Fortran.cmake")
endif()
get_target_property(F_INTERFACE_COMPILE_FLAGS fortran_project_options INTERFACE_COMPILE_OPTIONS)
Expand Down
2 changes: 1 addition & 1 deletion src/ParametricPreprocessor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ set(SKIP_BUILD_RPATH true)
add_executable(ParametricPreprocessor ${SRC})
set_target_properties(ParametricPreprocessor PROPERTIES FOLDER Auxiliary)

if(NOT UNIX) # Defined as top-level target on Unix only
if(NOT UNIX) # Need to reinclude it on Windows
include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Fortran.cmake")
endif()
get_target_property(F_INTERFACE_COMPILE_FLAGS fortran_project_options INTERFACE_COMPILE_OPTIONS)
Expand Down
2 changes: 1 addition & 1 deletion src/ReadVars/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ set(SKIP_BUILD_RPATH true)
add_executable(ReadVarsESO ${SRC})
set_target_properties(ReadVarsESO PROPERTIES FOLDER Auxiliary)

if(NOT UNIX) # Defined as top-level target on Unix only
if(NOT UNIX) # Need to reinclude it on Windows
include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Fortran.cmake")
endif()
get_target_property(F_INTERFACE_COMPILE_FLAGS fortran_project_options INTERFACE_COMPILE_OPTIONS)
Expand Down
2 changes: 1 addition & 1 deletion src/Slab/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ set(SKIP_BUILD_RPATH true)
add_executable(Slab ${SRC})
set_target_properties(Slab PROPERTIES FOLDER Auxiliary)

if(NOT UNIX) # Defined as top-level target on Unix only
if(NOT UNIX) # Need to reinclude it on Windows
include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Fortran.cmake")
endif()
get_target_property(F_INTERFACE_COMPILE_FLAGS fortran_project_options INTERFACE_COMPILE_OPTIONS)
Expand Down
2 changes: 1 addition & 1 deletion src/Transition/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ add_library(TransitionLib STATIC ${LIB_SRC})
target_include_directories(TransitionLib PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_compile_options(TransitionLib PUBLIC -fbounds-check)

if(NOT UNIX) # Defined as top-level target on Unix only
if(NOT UNIX) # Need to reinclude it on Windows
include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Fortran.cmake")
endif()
get_target_property(F_INTERFACE_COMPILE_FLAGS fortran_project_options INTERFACE_COMPILE_OPTIONS)
Expand Down

4 comments on commit 6670e31

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8722_HVAC_Diagram (jmarrec) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-UnitTestsCoverage-Debug: Build Failed

Build Badge Test Badge Coverage Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8722_HVAC_Diagram (jmarrec) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-IntegrationCoverage-Debug: Build Failed

Build Badge Test Badge Coverage Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8722_HVAC_Diagram (jmarrec) - x86_64-Linux-Ubuntu-18.04-gcc-7.5: Build Failed

Build Badge Test Badge

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8722_HVAC_Diagram (jmarrec) - x86_64-MacOS-10.15-clang-11.0.0: OK (3092 of 3092 tests passed, 0 test warnings)

Build Badge Test Badge

Please sign in to comment.