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

Create a CMake target upon install #123

Merged
merged 5 commits into from
Aug 25, 2023
Merged

Conversation

mheyman
Copy link
Contributor

@mheyman mheyman commented Aug 19, 2023

This updates the CMakeLists.txt file to include the ability to install. The install creates CMake target flux::flux for use in other CMake builds.

That is, you can build like:

cmake -S . -B build --install-prefix "$(realpath .)/install" -DFLUX_BUILD_EXAMPLES=Off -DFLUX_BUILD_TESTS=Off .
cmake --install build

and, in your consuming CMakeLists.txt, use like

find_package(flux CONFIG REQUIRED PATHS "path/to/flux/install")
target_link_libraries(mytarget PRIVATE flux::flux)

The README has an update for this and there is an additional file used as part of the CMake target creation.

@codecov
Copy link

codecov bot commented Aug 20, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (8434e8e) 97.70% compared to head (829c71e) 97.70%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #123   +/-   ##
=======================================
  Coverage   97.70%   97.70%           
=======================================
  Files          67       67           
  Lines        2398     2398           
=======================================
  Hits         2343     2343           
  Misses         55       55           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

flux-config.cmake.in Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@tcbrindle
Copy link
Owner

Thanks for the PR! Being able to install the library is definitely a good idea, so thanks for working on it.

Copy link
Owner

@tcbrindle tcbrindle left a comment

Choose a reason for hiding this comment

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

Thanks for the changes!

I noticed a couple of CMake warnings in the CI runs:

CMake Deprecation Warning at CMakeLists.txt:2 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


CMake Warning (dev) at /usr/local/share/cmake-3.27/Modules/GNUInstallDirs.cmake:243 (message):
  Unable to determine default CMAKE_INSTALL_LIBDIR directory because no
  target architecture is known.  Please enable at least one language before
  including GNUInstallDirs.
Call Stack (most recent call first):
  CMakeLists.txt:4 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- The CXX compiler identification is GNU 13.1.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/linuxbrew/.linuxbrew/bin/g++-13 - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning (dev) at CMakeLists.txt:13 (target_sources):
  Policy CMP0076 is not set: target_sources() command converts relative paths
  to absolute.  Run "cmake --help-policy CMP0076" for policy details.  Use
  the cmake_policy command to set the policy and suppress this warning.

  An interface source of target "flux" has a relative path.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- BAR=0

The first one isn't related to this PR (but feel free to bump the required CMake version to 3.5 while you're working on things if you wish).

I guess for the second warning the include(GnuInstallDirs) line needs to come after project(libflux CXX)?

I'm not sure what needs to be done to fix the warning about relative vs absolute paths?

CMakeLists.txt Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@tcbrindle
Copy link
Owner

Looks great, thank you!

@tcbrindle tcbrindle merged commit 1c128b5 into tcbrindle:main Aug 25, 2023
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