Closed restenb closed 1 year ago
set(CMAKE_CXX_STANDARD 17)
does the trick. Or target_compile_features(cosim PRIVATE "cxx_std_17").
However, this project is setup in a way that you need to copy dlls to run the executables using my normal worklow. I also got a weird runtime error when invoking cosim.exe:
error: internal: vector too long
Process finished with exit code 70
I think this happens because the code no longer gets compiled as C++17, and I believe the reason is the addition of the cmake_find_package
generator in conanfile.txt
.
Here‘s what‘s supposed to happen:
libcosim
has C++17 as a public compilation feature, meaning that libcosim
itself gets compiled as C++17, and this is also supposed to be inherited by client code.libcosim
's package configuration file[^1], to which the information about targets and their properies gets exported.cosim-cli
side, this file is supposed to be picked up by find_package(libcosim)
.My hunch is that find_package(libcosim)
now picks up the Findlibcosim.cmake
script that is generated by cmake_find_package
rather than the libcosim-config.cmake
script that gets installed alongside libcosim
.
I haven't picked up what the motivation was for using cmake_find_package
, but assuming that we need it, I still think this behaviour can be overridden. I'll suggest a change of the appropriate code line.
[^1]: The package configuration file is a CMake thing; it has nothing to do with Conan packages. You can find the instructions that generate it in libcosim
's main CMakeLists.txt
.
I've made a PR for proxyfmu that will fix the current issues. Will require a patch release of libcosim. Fixing it in the consumers is doable (like setting C++17 standard) in this PR, but it's patchwork from a deeper issue.
https://github.com/open-simulation-platform/proxy-fmu/pull/83
Updated again following 0.10.1 libcosim release & we're in the green again.
Tested & works locally on windows. Awaiting courtesy approval of changes before release.
Preparing for v0.10.0 release of cli as well.
@markaren @kyllingstad Thrift-related build error propagated here as well. Fixed by adding
CMAKE_MODULE_PATH
andCMAKE_PREFIX_PATH
but there are still problems building & linking the executable.Notably, there's a lot of errors like
error C2039: 'optional': is not a member of 'std'
, and various other errors about C++17. Maybe stdc++ needs to be linked?I was able to build cosim.exe by adding
target_compile_features(cosim PRIVATE "cxx_std_17")
, but then the required DLLs likeboost::program_options
are not linked.