Skip to content

Problems linking to installed preCICE static library via CMake #677

@j8asic

Description

@j8asic

I'm trying to link to static preCICE via target_link_libraries(myTarget PRIVATE precice::precice), but it does not work for me. Instead, I must manually import all the preCICE’s dependencies:

find_package(precice REQUIRED CONFIG)
set(Boost_USE_STATIC_LIBS ON)
find_package (Boost REQUIRED COMPONENTS system program_options filesystem log log_setup thread unit_test_framework)
find_package (Eigen3 REQUIRED NO_MODULE)

And then:

target_link_libraries (${PROJECT_NAME}
    PRIVATE
    precice::precice
    Eigen3::Eigen
    Boost::boost
    Boost::filesystem
    Boost::program_options
    Boost::system
    Boost::log
    Boost::log_setup
    Boost::thread
    Boost::unit_test_framework
)

And then still it wont work, because JSON and prettyprint are not found…

/usr/bin/ld: cannot find -lJSON
/usr/bin/ld: cannot find -lprettyprint

If this is needed, not renaming nlohmann_json to JSON could help, so people can use their system wide lib. And/or copy externally used json/printing libraries when make install.

System: Arch OS using newest CMake, preCICE, Eigen3, Boost, etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions