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: install pkg-config file relative to current_binary_dir #2318

Merged
merged 2 commits into from
Jul 28, 2020

Conversation

eli-schwartz
Copy link
Contributor

When the testsuite is enabled, the "cmake_add_subdirectory" test adds a second copy of the project into the build configuration, and the project files are installed twice.

This becomes super problematic when it tries to install a file from CMAKE_BINARY_DIR which is only available in CMAKE_CURRENT_BINARY_DIR and bombs out with the following error message:

[...]
-- Installing: <DESTDIR>/usr/lib/cmake/nlohmann_json/nlohmann_jsonTargets.cmake
CMake Error at test/cmake_add_subdirectory/nlohmann_json/cmake_install.cmake:73 (file):
  file INSTALL cannot find
  "......./nlohmann-json/builddir/test/cmake_add_subdirectory/nlohmann_json.pc":
  No such file or directory.
Call Stack (most recent call first):
  test/cmake_add_subdirectory/cmake_install.cmake:47 (include)
  test/cmake_install.cmake:49 (include)
  cmake_install.cmake:94 (include)

Fixes regression in #2253

When the testsuite is enabled, the "cmake_add_subdirectory" test
adds a second copy of the project into the build configuration, and the
project files are installed twice.

This becomes super problematic when it tries to install a file from
CMAKE_BINARY_DIR which is only available in CMAKE_CURRENT_BINARY_DIR
and bombs out with the following error message:

```
[...]
-- Installing: <DESTDIR>/usr/lib/cmake/nlohmann_json/nlohmann_jsonTargets.cmake
CMake Error at test/cmake_add_subdirectory/nlohmann_json/cmake_install.cmake:73 (file):
  file INSTALL cannot find
  "......./nlohmann-json/builddir/test/cmake_add_subdirectory/nlohmann_json.pc":
  No such file or directory.
Call Stack (most recent call first):
  test/cmake_add_subdirectory/cmake_install.cmake:47 (include)
  test/cmake_install.cmake:49 (include)
  cmake_install.cmake:94 (include)
```
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling aa06a47 on eli-schwartz:installfix into d34771c on nlohmann:develop.

Copy link
Owner

@nlohmann nlohmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@nlohmann nlohmann merged commit 1b8efed into nlohmann:develop Jul 28, 2020
@nlohmann
Copy link
Owner

Thanks!

@nlohmann
Copy link
Owner


🔖 Release item

This issue/PR will be part of the next release of the library. This template helps preparing the release notes.

Type

  • ✨ New Feature
  • 🐛 Bug Fix
  • ⚡️ Improvement
  • 🔨 Further Change
  • 🔥 Deprecated function

Description


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

Successfully merging this pull request may close these issues.

None yet

3 participants