- removed milestone
write_cmakefile(...) resp. the resulting CMakeLists.txt doesn't handle extra libs correctly when cpp sources are provided
Hi, I came across this issue when trying to use a custom "Expression" linked to additional libs. For this I followed the undocumented dolfin example "complied-extension-module" and changed it accordingly. Below is a diff that made this work for me, hopefully it is useful. I also made some other changes, so the line numbers of the path might not be correct. Besides the "fix" below, removing the two '\"' instead of adding the ';' also worked.
Btw: I am using cmake 3.4.1, just in case that this is rather a cmake bug.
@@ -508,12 +532,13 @@ endif()
swig_add_module(${SWIG_MODULE_NAME} python ${SWIG_SOURCES})
set(EXTRA_LIBRARIES %(extra_libraries)s)
+
if(SOURCE_FILES)
set(CMAKE_CXX_FLAGS \"${CMAKE_CXX_FLAGS} -fpic\")
add_library(source_file_lib
STATIC
${SOURCE_FILES})
- set(EXTRA_LIBRARIES \"source_file_lib ${EXTRA_LIBRARIES}\")
+ set(EXTRA_LIBRARIES \"source_file_lib;${EXTRA_LIBRARIES}\")
endif()
if(EXTRA_LIBRARIES)
Comments (4)
-
-
Could you propose a pull request, @rambausek?
-
reporter It's quite some time ago that I used this mechanism for my custom Expression, but as far as I remember, the main thing is the semicolon added. I'll try to prepare a pull request. I've never done this before... but I'll try next week when I've some time left. And I guess I also have to send you the copyright consent form (mgiht take some time since my boss is on holidays the next two weeks). Stay tuned!
-
- changed status to resolved
Fixed by a16d66b.
- Log in to comment
Removing milestone: 1.7 (automated comment)