Linking a library from another module

21 views
Skip to first unread message

Karol Lewandowski

unread,
Dec 10, 2021, 10:37:39 AM12/10/21
to MoFEM Q&A
I would like to link in my module a library that is created in mortar contact, how do I do that? 

In CMakeLists.txt, mortar contact creates a library like this
add_library(mortar_contact_all
  ${CMAKE_CURRENT_SOURCE_DIR}/src/impl/AllMortar.cpp
  ${CMAKE_CURRENT_SOURCE_DIR}/src/impl/MortarContactInterface.cpp)
Now in my module txt I would like to include something like this:

```
if(WITH_MODULE_MORTAR_CONTACT)
target_link_libraries(mofem_manager
users_modules
mortar_contact_all
...
endif(WITH_MODULE_MORTAR_CONTACT)
```
and e.g.
```cmake
if(WITH_MODULE_MORTAR_CONTACT)
include(${PROJECT_SOURCE_DIR}/mortar_contact/mortar_contact_all_targets.cmake)
include_directories(${PROJECT_SOURCE_DIR}/mortar_contact/src)
...
```

How to check properly if mortar is installed in our users modules?

Reply all
Reply to author
Forward
0 new messages