-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.mod files not found during (cmake) compilation #85
Comments
It seems I'm having the same problem, I'm getting "Fatal Error: Cannot open module file 'bspline_module.mod' for reading at (1): No such file or directory" (at |
So, it seems that we need to make sure that, in addition to the library, we need to make sure that all targets find the module files in the (non-default) In my case, after bspline-fortran/CMakeLists.txt Line 122 in 85cbfe1
target_include_directories(${prog_name} PUBLIC $<TARGET_PROPERTY:${LIB_NAME}-static,Fortran_MODULE_DIRECTORY>) fixes the problem at least for the test executables. |
I'm not a CMake expert so I'm not sure what the proper solution is. If this works, I can merge it in. See also: #31 |
I think this is a better patch, inspired by CMake issues and jacobwilliams/json-fortran@d8dc940: diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7754d07..20aba1c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -73,6 +73,11 @@ endif()
add_library( ${LIB_NAME} SHARED ${SOURCES} )
add_library( ${LIB_NAME}-static STATIC ${SOURCES} )
+# Make sure modules for the static library can be found by depending targets
+# put together from hints in https://gitlab.kitware.com/cmake/cmake/-/issues/24223
+# and https://gitlab.kitware.com/cmake/cmake/-/issues/25425
+target_include_directories(${LIB_NAME}-static PUBLIC $<BUILD_INTERFACE:${MODULE_DIR}>)
+
set_target_properties(${LIB_NAME}-static
PROPERTIES
OUTPUT_NAME "${LIB_NAME}"
|
Hello, I have never used cmake, so I have (I think) a very dumb question.
I'm trying to compile with cmake, so I followed the readme and started the compilation with
make
. The problem is that after few instant the compilation stops with an error since it cannot find the .mod files (that are inside the lib directory).Is there something that is not written in the readme that I should do ? It seems that the makefile doesn't know where to look for .mod files.
Thanks in advance !
The text was updated successfully, but these errors were encountered: