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()
3434
3535option (BUILD_SHARED_LIBS "Build shared libraries" ON )
3636
37+ set (FLIBCPP_FORTRAN_STD "f2003" CACHE STRING
38+ "Fortran standard for compiling generated code" )
39+
3740#---------------------------------------------------------------------------#
3841# SWIG setup
3942#---------------------------------------------------------------------------#
@@ -152,12 +155,19 @@ function(swig_fortran_add_module name)
152155 )
153156 endif ()
154157
155- # Enable C++11
158+ # Compile C++ code with C++11
156159 target_compile_features (${name}
157160 PRIVATE
158161 cxx_std_11
159162 )
160163
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+
161171 target_include_directories (${name}
162172 PUBLIC
163173 # Fortran modules
Original file line number Diff line number Diff line change 22BUILD=/rnsdhpc/code/build/flibcpp
33SOURCE=/rnsdhpc/code/src/flibcpp
44
5- test -d " $BUILD " || mkdir " $BUILD "
5+ test -d " $BUILD " || mkdir -p " $BUILD "
66cd $BUILD
77
88cmake \
@@ -11,8 +11,8 @@ cmake \
1111 -D SWIG_EXECUTABLE=" /rnsdhpc/code/build/swig-debug/swig" \
1212 -D SWIG_DIR=" /rnsdhpc/code/src/swig/Lib" \
1313 -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" \
1515 -D CMAKE_CXX_FLAGS=" -Wall -Wextra" \
16- -D CMAKE_INSTALL_PREFIX=" /rnsdhpc/code/install/flibcpp"
16+ -D CMAKE_INSTALL_PREFIX=" /rnsdhpc/code/install/flibcpp" \
1717 $SOURCE
1818ninja
You can’t perform that action at this time.
0 commit comments