Skip to content

Programm statically linked but still needs dll to run #692

@zulugithub

Description

@zulugithub

I'm new to cmake and to sundials. I'm following the instructions for projects that use CMake in the documentation (https://sundials.readthedocs.io/en/v7.3.0/sundials/Install_link.html#cmake-projects) but changed the last line to target_link_libraries(myexec PUBLIC SUNDIALS::core_static SUNDIALS::cvode_static) and added #define SUNDIALS_STATIC_DEFINE to my test file (cvRocket_dns.c). The resulting .exe fails to run with a missing sundials_core.dll error. Changing the SUNDIALSTargets.cmake in INSTALL_DIR from

set_target_properties(SUNDIALS::cvode_static PROPERTIES
  INTERFACE_COMPILE_DEFINITIONS "SUNDIALS_STATIC_DEFINE"
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
  INTERFACE_LINK_LIBRARIES "SUNDIALS::core_shared"
)

to

set_target_properties(SUNDIALS::cvode_static PROPERTIES
  INTERFACE_COMPILE_DEFINITIONS "SUNDIALS_STATIC_DEFINE"
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
  INTERFACE_LINK_LIBRARIES "SUNDIALS::core_static"    <========
)

solves the problem.

Is it intended that all static libraries depend on SUNDIALS::core_shared?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions