File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,9 @@ endif()
34
34
35
35
option (BUILD_SHARED_LIBS "Build shared libraries" ON )
36
36
37
+ set (FLIBCPP_FORTRAN_STD "f2003" CACHE STRING
38
+ "Fortran standard for compiling generated code" )
39
+
37
40
#---------------------------------------------------------------------------#
38
41
# SWIG setup
39
42
#---------------------------------------------------------------------------#
@@ -152,12 +155,19 @@ function(swig_fortran_add_module name)
152
155
)
153
156
endif ()
154
157
155
- # Enable C++11
158
+ # Compile C++ code with C++11
156
159
target_compile_features (${name}
157
160
PRIVATE
158
161
cxx_std_11
159
162
)
160
163
164
+ if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" )
165
+ # Compile Fortran code with given standard
166
+ target_compile_options (${name}
167
+ PUBLIC $< $< COMPILE_LANGUAGE:Fortran> :-std=${FLIBCPP_FORTRAN_STD} >
168
+ )
169
+ endif ()
170
+
161
171
target_include_directories (${name}
162
172
PUBLIC
163
173
# Fortran modules
Original file line number Diff line number Diff line change 2
2
BUILD=/rnsdhpc/code/build/flibcpp
3
3
SOURCE=/rnsdhpc/code/src/flibcpp
4
4
5
- test -d " $BUILD " || mkdir " $BUILD "
5
+ test -d " $BUILD " || mkdir -p " $BUILD "
6
6
cd $BUILD
7
7
8
8
cmake \
@@ -11,8 +11,8 @@ cmake \
11
11
-D SWIG_EXECUTABLE=" /rnsdhpc/code/build/swig-debug/swig" \
12
12
-D SWIG_DIR=" /rnsdhpc/code/src/swig/Lib" \
13
13
-D BUILD_SHARED_LIBS=ON \
14
- -D CMAKE_Fortran_FLAGS=" -Wall -Wextra -Wimplicit-procedure -Wimplicit-interface -Wno-compare-reals -std=f2003 " \
14
+ -D CMAKE_Fortran_FLAGS=" -Wall -Wextra -Wimplicit-procedure -Wimplicit-interface -Wno-compare-reals" \
15
15
-D CMAKE_CXX_FLAGS=" -Wall -Wextra" \
16
- -D CMAKE_INSTALL_PREFIX=" /rnsdhpc/code/install/flibcpp"
16
+ -D CMAKE_INSTALL_PREFIX=" /rnsdhpc/code/install/flibcpp" \
17
17
$SOURCE
18
18
ninja
You can’t perform that action at this time.
0 commit comments