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

CMake uninstall target conflicts with other previously registered uninstall targets #128

Open
bear24rw opened this issue Jan 27, 2023 · 0 comments · May be fixed by #141
Open

CMake uninstall target conflicts with other previously registered uninstall targets #128

bear24rw opened this issue Jan 27, 2023 · 0 comments · May be fixed by #141

Comments

@bear24rw
Copy link

I am trying to build netcdf-c & netcdf-cxx4 within a cmake project via FetchContent. Both netcdf-c and netcdf-cxx4 register an uninstall which violates CMP0002 and causes cmake to fail with this error:

CMake Error at build/_deps/netcdf-cxx4-src/CMakeInstallation.cmake:109 (ADD_CUSTOM_TARGET):
  ADD_CUSTOM_TARGET cannot create target "uninstall" because another target
  with the same name already exists.  The existing target is a custom target
  created in source directory
  "build/_deps/netcdf-c-src".
  See documentation for policy CMP0002 for more details.
Call Stack (most recent call first):
  build/_deps/netcdf-cxx4-src/CMakeLists.txt:688 (INCLUDE)

Other projects have solved this issue by wrapping the custom target in an option() so that users can disable the target.

This is the same issue as Unidata/netcdf-c#2597

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 a pull request may close this issue.

1 participant