NTNU-IHB / FMI4cpp

FMI 2.0 implementation written in modern C++.
MIT License
93 stars 34 forks source link

Public BOOST linker settings problematic #102

Closed Thantalos closed 3 years ago

Thantalos commented 3 years ago

In this line, the Boost settings for fmi4cpp are set publicly: https://github.com/NTNU-IHB/FMI4cpp/blob/248193332713a2bc5714551f5ebcaf41179c8500/src/CMakeLists.txt#L105

This means when using fmi4cpp::fmi4cpp in an other cmake file to link agains FMI4CPP, these settings are copied over. When I then want to use a part of Boost that requires linking against the boost libraries, the build fails because the public settings above block cmake from linking agains boost.

I'm not sure whether these settings are reuquired at all but at least they should be private.

markaren commented 3 years ago

I'm no CMake guru myself, and I honestly don't know if they can/should be public or private. I can make a build, and if it works with private it is probably ok.

markaren commented 3 years ago

Doing the change looks fine for conan build, but fails building the tests using apt-get dependencies. Not entirely sure how to fix.

Thantalos commented 3 years ago

I'm no CMake guru myself

Me neither. But I think I understand this part. PUBLIC means, that the settings are copied to dependencies whereas PRIVATE applies them to the build in question only. It should make no difference to the way FMI4CPP is build. Only to other projects, using the generated fmi4cpp-config.cmake-file.

Doing the change looks fine for conan build, but fails building the tests using apt-get dependencies.

I'm sorry. I don't have a circleCI account and therefore can't see the error messages.

markaren commented 3 years ago

The PR built fine once I applied the compile definitions to the test executable targets.