-
Notifications
You must be signed in to change notification settings - Fork 28
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
Building libsbml and its dependencies in the same project #227
Comments
The expat find script compiles against expat, to see whether further compile definitions are necessary to compile against it. I suppose we could skip those tests in case you already define a expat target. In any case instead for you defining the expat library and include dir, it should be fine to define
and try the following patch: diff --git a/CMakeLists.txt b/CMakeLists.txt
index 53a0d2eaf..a7b840729 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -419,7 +419,9 @@ set(LIBSBML_XML_LIBRARY_LIBS)
if(WITH_EXPAT)
+ if(NOT TARGET EXPAT::EXPAT)
find_package(EXPAT REQUIRED)
+ endif()
add_definitions( -DUSE_EXPAT )
list(APPEND SWIG_EXTRA_ARGS -DUSE_EXPAT)
|
That worked! Or at least, I could make it work. I had to 'FORCE' the expat library settings; apparently I need to FORCE anything in libsbml I want to set in CMake itself:
I assume you'll want to do the same with the other XML libraries, too? And the ZIP libraries? |
I'm not entirely sure why you need the |
If I leave them out entirely, they aren't defined, and libsbml won't compile, complaining that it doesn't know where 'zconf.h' is. If I put them in like I had originally, they get replaced by the generic UNKNOWN stand-ins. I had to define them with FORCE to get them to work. |
zconf indicates, that potentiall the zlib target is missing some adjustments for your usecase. tbh: i always prefered to have dependencies be built once, instead of all the time together with the actual target you want to build. So while i think it is good to support your usecase, i think it is not the way to focus on. Dependencies can be cached with a ccache action. And i hope that is what we are doing (still learning on that myself). |
has this been resolved? |
I had just made my own branch and used that forever, but I'm now trying to revert back to 'development'. It seems that everything now mostly works, except that the zlib.h check incorrectly fires. #388 added. |
I have a problem. I'm trying to build libsbml in a project where libsbml's dependencies are also being built at the same time. The problem is that when libsbml tries to find expat, it sees that expat hasn't been built yet, and fails. However, this is to be expected: the system is going to build both expat and libsbml; it just has to wait.
Here's the relevant bits of my CMakeLists.txt file:
and here's the error message I get from CMake:
If I comment out the lines defining EXPAT_INCLUDE_DIR and EXPAT_LIBRARY, I get:
The text was updated successfully, but these errors were encountered: