Skip to content

Commit 9be2fe4

Browse files
committed
[cmake] Simplified ProcessLib setup.
1 parent 085587e commit 9be2fe4

File tree

1 file changed

+20
-39
lines changed

1 file changed

+20
-39
lines changed

ProcessLib/CMakeLists.txt

Lines changed: 20 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,17 @@
22
add_library(Processes INTERFACE)
33

44
# Check whether LIE processes are enabled
5-
function(check_enabled_processes_for_LIE contains_LIE)
6-
set(${contains_hm_process} FALSE PARENT_SCOPE)
7-
foreach(process ${_enabled_processes})
8-
if(process STREQUAL "LIE_M"
9-
OR process STREQUAL "LIE_HM"
10-
)
11-
set(${contains_LIE} TRUE PARENT_SCOPE)
12-
return()
13-
endif()
14-
endforeach()
15-
endfunction()
16-
check_enabled_processes_for_LIE(contains_LIE)
17-
18-
if (contains_LIE)
19-
add_subdirectory(LIE/Common)
20-
endif()
5+
foreach(process ${_enabled_processes})
6+
if(process STREQUAL "LIE_M" OR process STREQUAL "LIE_HM")
7+
add_subdirectory(LIE/Common)
8+
break()
9+
endif()
10+
endforeach()
2111

2212
foreach(process ${_enabled_processes})
23-
if (process STREQUAL "LIE_HM")
13+
if(process STREQUAL "LIE_HM")
2414
add_subdirectory(LIE/HydroMechanics)
25-
elseif (process STREQUAL "LIE_M")
15+
elseif(process STREQUAL "LIE_M")
2616
add_subdirectory(LIE/SmallDeformation)
2717
else()
2818
add_subdirectory(${process})
@@ -43,27 +33,18 @@ append_source_files(SOURCES Utils)
4333
append_source_files(SOURCES Reflection)
4434
append_source_files(SOURCES Graph)
4535
# For processes that contains both hydraulical process and mechanical process
46-
# Define a function to check if enabled_processes contains LIE, HydroMechanics,
47-
# ThermoHydroMechanics, RichardsMechanics, or ThermoRichardsMechanics
48-
function(check_enabled_processes contains_hm_process)
49-
set(${contains_hm_process} FALSE PARENT_SCOPE)
50-
foreach(process ${_enabled_processes})
51-
if(process STREQUAL "LIE_HM"
52-
OR process STREQUAL "HydroMechanics"
53-
OR process STREQUAL "ThermoHydroMechanics"
54-
OR process STREQUAL "RichardsMechanics"
55-
OR process STREQUAL "TH2M"
56-
OR process STREQUAL "ThermoRichardsMechanics"
57-
)
58-
set(${contains_hm_process} TRUE PARENT_SCOPE)
59-
return()
60-
endif()
61-
endforeach()
62-
endfunction()
63-
check_enabled_processes(contains_hm_process)
64-
if(contains_hm_process)
65-
append_source_files(SOURCES Common/HydroMechanics)
66-
endif()
36+
foreach(process ${_enabled_processes})
37+
if(process STREQUAL "LIE_HM"
38+
OR process STREQUAL "HydroMechanics"
39+
OR process STREQUAL "ThermoHydroMechanics"
40+
OR process STREQUAL "RichardsMechanics"
41+
OR process STREQUAL "TH2M"
42+
OR process STREQUAL "ThermoRichardsMechanics"
43+
)
44+
append_source_files(SOURCES Common/HydroMechanics)
45+
break()
46+
endif()
47+
endforeach()
6748

6849
ogs_add_library(ProcessLib GENERATE_EXPORT_HEADER ${SOURCES})
6950

0 commit comments

Comments
 (0)