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 incorrectly installs config files when passed absolute values #9809

Closed
jonringer opened this issue Apr 20, 2022 · 0 comments · Fixed by #9822
Closed

Cmake incorrectly installs config files when passed absolute values #9809

jonringer opened this issue Apr 20, 2022 · 0 comments · Fixed by #9822

Comments

@jonringer
Copy link
Contributor

jonringer commented Apr 20, 2022

install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_CMAKEDIR}/
DESTINATION "${CMAKE_INSTALL_CMAKEDIR}"
COMPONENT protobuf-export
PATTERN protobuf-targets.cmake EXCLUDE
)

Is the offending offending section.

CMAKE_CURRENT_BINARY_DIR will be some build directory (e.g. /build/source/build/)
CMAKE_INSTALL_CMAKEDIR inherits from CMAKE_INSTALL_LIBDIR (e.g. /nix/store/x4bq4v508n8pxazh9137hcd64i40fvb0-protobuf-3.15.8/lib/cmake/protobuf)

The resultant /build/source/build//nix/store/x4bq4v508n8pxazh9137hcd64i40fvb0-protobuf-3.15.8/lib/cmake/protobuf is not a path which can install files.

What version of protobuf and what language are you using?
Version: 3.15, but still an issue in master
Language: C++

What operating system (Linux, Windows, ...) and version?

$ uname -a
Linux jon-desktop 5.4.188 #1-NixOS SMP Mon Mar 28 06:46:49 UTC 2022 x86_64 GNU/Linux

What runtime / compiler are you using (e.g., python version or gcc version)

$ gcc --version
gcc (GCC) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

What did you do?
Steps to reproduce the behavior:

cd cmake
mkdir build
cd build
cmake --build ..

What did you expect to see
It not fail to find directory

What did you see instead?
Failure around incorrect path

Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).

       > CMake Error at cmake_install.cmake:1693 (file):
       >   file INSTALL cannot find
       >   "/build/source/build//nix/store/x4bq4v508n8pxazh9137hcd64i40fvb0-protobuf-3.15.8/lib/cmake/protobuf":
       >   No such file or directory.

Anything else we should know about your project / environment
Using Nix

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