Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using -DCMAKE_INSTALL_PREFIX with build produces flat include folder & does not include DLL #103

Open
AndrewAtAvenza opened this issue Jan 4, 2023 · 3 comments

Comments

@AndrewAtAvenza
Copy link

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.

@AndrewAtAvenza
Copy link
Author

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.

@turtledreams
Copy link
Contributor

Hi, would love to see your CMakeList for sure. We want to look into any options to make things sturdier.

@AndrewAtAvenza
Copy link
Author

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.

CMakeLists.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants