Skip to content

introducing protection to prevent multiple target declaration for uni… #85

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

Merged

Conversation

fe-dagostino
Copy link
Contributor

introducing protection to prevent multiple target declaration for uninstall.

@kjellahl kjellahl merged commit 9fc3416 into libsigcplusplus:master Jan 21, 2023
@kjellahl
Copy link
Contributor

I very seldom use CMake. I don't know much about it. I trust that your patch
is an improvement. It had been even better if you had mentioned in the commit
message that it concerns building with CMake.

@fe-dagostino
Copy link
Contributor Author

Hi @kjellahl thanks for the trust! Anyway in my opinion you did a good work with the CMake and between me and you, and maybe the rest of people reading this message :D, no one know everything about CMake it is really an huge project.
The change solve a simple problem that occurs when you are using submodules.
Suppose to have a CMakeLists.txt in which you have for example

add_subdirectory(submodules/glm )
add_subdirectory(submodules/libsigc++)

both are adding a target that is "uninstall" so in both submodules you have something like

add_custom_target( uninstall ...

Then without such control the second time that add_custom_target will be invoked, an error will be generated and then build will stop.

Now if you use the project stand alone, so to build it, install and eventually install also the uninstaller it make sense to have the uninstaller target, instead if you are using the project as submodule it will be not installed, just generated and creating the uninstall target is not necessary, then can be avoided.

One other way can be to add an option in CMakeLists.txt that allow to enable/disable uninstall target in this specific case.

Please let me know if the clarification works.

@kjellahl
Copy link
Contributor

Your clarification is fine.

CMake support was added by Marcin Kolny in 2016. There have only been minor
updates to the CMake files after that.

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

Successfully merging this pull request may close these issues.

2 participants