countly-sdk-cpp
countly-sdk-cpp copied to clipboard
Using -DCMAKE_INSTALL_PREFIX with build produces flat include folder & does not include DLL
If you use -DCMAKE_INSTALL_PREFIX=[some folder] when generating the build files, and then use --target install, you get a badly formed output folder.
The DLL is the easiest one to fix.
install(TARGETS countly ARCHIVE DESTINATION lib PUBLIC_HEADER DESTINATION include/countly)
Should be
install(TARGETS countly ARCHIVE DESTINATION lib PUBLIC_HEADER DESTINATION include/countly RUNTIME DESTINATION bin)
This way, there will be a bin folder containing the countly.dll.
There are a few errors with the include setup. First, countly.hpp needs to be removed from COUNTLY_PUBLIC_HEADERS. While we're at it, add countly_configuration.hpp, which is missing!
Next, add this additional install step at the end of the file:
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/countly.hpp DESTINATION include)
This will separately install countly.hpp in the root include folder in the install directory, creating the expected setup.
I can share my version of the CMakeLists.txt if that helps. I'm not say you should necessarily adopt it, but it might provide an idea of where things could use some shoring up. I also tightened up the sqlite pathing so it actually uses the results of find_package(sqlite), which allows someone like me to override using the bundled sqlite in favour of the one we're using elsewhere in our product.
Hi, would love to see your CMakeList for sure. We want to look into any options to make things sturdier.
Sure, here's what I'm using currently. I can't remember if I've made any other changes, but obviously feel free to use or ignore whatever you want.