Skip to content

Commit d043736

Browse files
authored
Merge pull request #11 from swig-fortran/minor-cmake
Minor CMake updates/fixes
2 parents 75490a2 + 1910b64 commit d043736

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ if (FLIBCPP_FORTRAN_STD AND NOT FLIBCPP_FORTRAN_STD STREQUAL "none")
4848
"FLIBCPP_FORTRAN_STD=${FLIBCPP_FORTRAN_STD}. Configure with "
4949
"the FFLAGS environment variable or explicitly specify "
5050
"CMAKE_Fortran_FLAGS")
51-
set(_FLIBCPP_STD_FLAGS "none" CACHE FORCE STRING "")
51+
set(FLIBCPP_FORTRAN_STD "none" CACHE FORCE STRING "")
5252
endif()
5353
endif()
5454

@@ -84,6 +84,8 @@ if (FLIBCPP_USE_SWIG AND SWIG_FOUND)
8484
cmake_policy(SET CMP0086 "NEW")
8585
include(UseSWIG)
8686
endif()
87+
set(FLIBCPP_SWIG_EXECUTABLE "${SWIG_EXECUTABLE}")
88+
set(FLIBCPP_SWIG_DIR "${SWIG_DIR}")
8789
else()
8890
set(FLIBCPP_USE_SWIG FALSE)
8991
endif()
@@ -102,7 +104,7 @@ set(FLIBCPP_INTERFACE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
102104
set(FLIBCPP_GENERATE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
103105
set(FLIBCPP_INSTALL_CONFIGDIR "${CMAKE_INSTALL_LIBDIR}/cmake/Flibcpp")
104106
set(FLIBCPP_INSTALL_MODULEDIR "${CMAKE_INSTALL_INCLUDEDIR}")
105-
set(FLIBCPP_NAMESPACE Flibcpp::)
107+
set(FLIBCPP_NAMESPACE "Flibcpp::")
106108

107109
# List of libraries exported by cmake/FlibcppConfig.cmake.in
108110
set(FLIBCPP_LIBRARIES)
@@ -158,6 +160,7 @@ function(flibcpp_add_module name)
158160
cxx_std_11
159161
)
160162
if (_FLIBCPP_STD_FLAGS)
163+
# Compile Fortran code with a particular standard
161164
target_compile_options(${name}
162165
PUBLIC $<$<COMPILE_LANGUAGE:Fortran>:${_FLIBCPP_STD_FLAGS}>
163166
)

cmake/CheckSWIGFortran.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ if (NOT SWIG_CHECKED_FORTRAN)
1616
if (NOT SWIG_help_output MATCHES "Fortran")
1717
message(FATAL_ERROR "This version of SWIG does not support Fortran "
1818
"wrapping. Please install the version from "
19-
"https://github.com/sethrj/swig")
19+
"https://github.com/swig-fortran/swig")
2020
endif()
2121
set(SWIG_CHECKED_FORTRAN TRUE CACHE INTERNAL "")
2222
endif()

cmake/FlibcppConfig.cmake.in

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,13 @@ endif()
99

1010
set(Flibcpp_LIBRARIES @FLIBCPP_LIBRARIES@)
1111

12-
set(Flibcpp_BUILD_SHARED_LIBS @BUILD_SHARED_LIBS@)
12+
set(FLIBCPP_BUILD_SHARED_LIBS @BUILD_SHARED_LIBS@)
13+
set(FLIBCPP_USE_SWIG @FLIBCPP_USE_SWIG@)
14+
set(FLIBCPP_FORTRAN_STD @FLIBCPP_FORTRAN_STD@)
15+
set(FLIBCPP_SWIG_EXECUTABLE @FLIBCPP_SWIG_EXECUTABLE@)
16+
set(FLIBCPP_SWIG_DIR @FLIBCPP_SWIG_DIR@)
1317

14-
if (NOT "@Flibcpp_BUILD_SHARED_LIBS@")
18+
if (NOT FLIBCPP_BUILD_SHARED_LIBS)
1519
# Downstream libraries must find and link to the C++ runtimes themselves since
1620
# they can't use the shared library dependencies
1721
enable_language(CXX)

0 commit comments

Comments
 (0)